question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Argument `--parameter-values` gives JSON parse error

See original GitHub issue

Running with the option --parameter-values as documented does not work, but gives a JSON parse exception:

PS C:\my-dir> npx angular-prerender --parameter-values '{":name":["amelia","oliver"]}'
Opties:
  --version           Toon versienummer                              [booleaans]
  --help              Toon help                                      [booleaans]
  --browser-target    specify the target inside your angular.json file which is
                      used to build the single page app
                                                   [string] [standaard: "build"]
  --config            specify the path to the angular.json file
                                                            [string] [standaard:
               "C:\mydir\angular.json"]
  --parameter-values  specify the parameter values which should be replaced with
                      the parameter in the routes     [string] [standaard: "{}"]
  --server-target     specify the target inside your angular.json file which is
                      used to build the server side code
                                                  [string] [standaard: "server"]
  --verbose, -v       set this flag if you prefer more detailed log messages
                                                  [booleaans] [standaard: false]

Unexpected token : in JSON at position 1

I tried other ways but did not yet succeed, except with an empty map: PS C:\my-dir> npx angular-prerender --parameter-values '{}'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
aristoteloscommented, Jan 15, 2020

I just found out what is a solution here: enclose the value in double quotes like this:

npx angular-prerender --parameter-values '\"{\\\":name\\\":[\\\"am e l i a\\\",\\\"o l i v e r\\\"]}\"'
0reactions
chrisguttandincommented, Jan 15, 2020

Wow, I’m glad you found a solution. I added a small paragraph to the readme to mention that escaping might be an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
Getting Error in JSON Parsing while sending an JSON object ...
So let's create a JSONObject in your client and add it to the parameters list: // Let's build the JSONObject we want to...
Read more >
JSON Parser error in Amplify · Issue #6097 - GitHub
Amplify gives JSON parser error when we deploy the code to new AWS ... Infact the only thing I do have is a...
Read more >
SyntaxError: JSON.parse: bad parsing Breaking Your Code ...
The JSON Parse error, as the name implies, surfaces when using the JSON.parse() method that fails to pass valid JSON as an argument....
Read more >
Catching Invalid JSON Parse Errors with Rack Middleware
Example errors. The error thrown by the parameter parsing middleware behaves differently depending on your version of Rails: 3.2 throws a 500 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found