-
Notifications
You must be signed in to change notification settings - Fork 7
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
Argument --parameter-values
gives JSON parse error
#102
Comments
Hi @aristotelos, thanks for bringing this to my attention. I can't reproduce the problem which is why I have the feeling that this could be an incompatibility between macOS and Windows. Does it work if you use some other type of quotes? |
Well, PowerShell has single quotes as its standard escape character, so this seems the best option. I also tried with double quotes like this, but it fails:
Even simple JSON like this fails:
|
Thanks for checking again. I believe now that all quotes somehow get lost. I don't know why though. If you execute I improved the error messages in v4.3. It will not help with the problem but it will help to verify my assumption because it logs the values as part of the error that could not be parsed. Can you please check again with the latest version? Many thanks in advance. |
Just a quick follow up. I found this documentation for the AWS CLI. It explains how to escape JSON values for PowerShell. https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html Does it work if you escape all quotes with a backslash and run: |
No, it doesn't work unfortunately. I'll show a couple of commands that I tried so far with their output.
I even tried using cmd instead, but also with no success. It seems the
|
It seems like a hopeless attempt but the AWS docs say the cmd prompt should be encapsulated in double quotes. Maybe that's a combination worth trying.
Does that work? |
Tried that too, doesn't work:
|
To be honest I have no idea, what else you could try. But I was thinking about supporting files as well. Maybe that could be a solution which works for you as well. What would you think about something like this?
|
I have found a way! Using an escaped backslash and escaped double quote actually works, in both PowerShell and cmd:
It may have to do with this issue. |
The next question is: how do I escape a space inside a parameter value... |
Wow thanks for the follow up. I will update the README once we resolved this issue. Normally I would say don't escape whitespace at all, but I guess that doesn't work for you, right?
|
Well, that doesn't work, it ends up with:
I again tried one, two or three or four slashes, but that doesn't work... Because it seems to be a PowerShell or general npx issue I will close it here. |
I just found out what is a solution here: enclose the value in double quotes like this:
|
Wow, I'm glad you found a solution. I added a small paragraph to the readme to mention that escaping might be an issue. |
Running with the option
--parameter-values
as documented does not work, but gives a JSON parse exception:I tried other ways but did not yet succeed, except with an empty map:
PS C:\my-dir> npx angular-prerender --parameter-values '{}'
The text was updated successfully, but these errors were encountered: