Note: When doing a project, I encountered the need to transfer a line of data objects to another page, using JSON.stringify => JSON.parse and then transferring it by url:
Then the error is reported as follows:
Later, after reviewing the relevant information, we found that we need to add a coding and decoding process, as follows:
After printing, the object appears:
Cause analysis:
Reason: If an address is encountered in the parameters of the object or the elements of the array, and the address includes ? and & these special symbols, the object/array must first be converted to a string by JSON.stringify and then encoded by encodeURIComponent, when received, first decoded by decodeURIComponent and then converted to JSON format object/array by JSON.parse
Read More:
- Syntaxerror: unexpected end of JSON input [How to Solve]
- [Solved] Parsing JSON error unexpected end of JSON input
- [Solved] SyntaxError:JSON.parse:unexpected character at line 1 column 1 of the JSON data
- frida.InvalidArgumentError: script(line *): SyntaxError: unexpected end of string
- vue VM682:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
- [Solved] JSON parse error: Unexpected character (‘‘‘ (code 39)): was expecting double-quote to start ……
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- [Solved] JSON parse error: Unexpected character (‘‘‘ (code 39)): was expecting double-quote to star
- Solution: configuration of multiple front ends separated from front end and back end of nginx
- Json: struct field readyReplicas has json tag but is not exported [How to Solve]
- Uncaught SyntaxError: Cannot use import statement outside a module
- [Solved] Interface automation test: JSON parse error
- [Solved] node Error: SyntaxError: Cannot use import statement outside a module
- [Solved] Docker Error: SyntaxError: Non-ASCII character ‘\xe5‘ in file xxx
- Sqoop Error: Can‘t parse input data: ‘\N‘ [How to Solve]
- [Solved] Git Push Error: &fatal: the remote end hung up unexpectedly
- [Solved] HTML_Uncaught SyntaxError: Cannot use import statement outside a module
- [Solved] hello.s:15 Error: junk at end of line, first unrecognized character valued 0x8
- [Solved] MongoDB Error: TypeError: Object of type ObjectId is not JSON serializable
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]