Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with JSON parameter at MOS.EXE command line #193

Closed
Denis2106 opened this issue Feb 19, 2017 · 4 comments
Closed

Problem with JSON parameter at MOS.EXE command line #193

Denis2106 opened this issue Feb 19, 2017 · 4 comments
Assignees

Comments

@Denis2106
Copy link

I try command > MOS.EXE CALL FS.Remove '{"filename": "test"}' and have response:
Error: Args ['{filename:test}'] is not a valid JSON string.

I try to write args: "{'filename':'test'}", {"filename": "test"}, {"filename": "test"}, {filename: test}
In all cases i have one response: not valid JSON string.

@MobiusHorizons
Copy link

escaped quotes might help"{\"filename\":\"test\"}". You can always tell what's actually getting to the program by testing with echo. However on OSX echo '{"filename":"test"}' returns {"filename":"test"} as expected, but it's worth a shot anyway.

@Uriziel01
Copy link

I figured it out that JSON strings are corrupted only in Windows default command line.
If You use another terminal like cygwin it works just fine.

It should easly resolved in mos.exe by parameters sanitization.

@cpq
Copy link
Member

cpq commented Mar 2, 2017

@alashkin please fix that windows

@alashkin
Copy link
Contributor

Unfortunately, this behavior is normal for Windows: its command interpreter (aka command.com) uses double quote character for parameter concatenation. (ex: myprogram "param with space")
To get "real" quote you have to somehow escape double quotes.
ex:
mos call FS.Remove {"""filename""":"""test"""}
mos call FS.Remove {\"filename\": \"test\"}
Note, if you put space between {, filename, :, test or } you need to use " for grouping:
mos call FS.Remove "{\"filename\": \"test\" }"

Not sure we can fix it in normal way, this is how windows work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants