mholt/json-to-go

JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data

3052 opened this issue · 2 comments

3052 commented

input:

{
    "message": {
        "subject": "Meet for lunch?",
        "body": {
            "content": "The new cafeteria is open."
        },
        "toRecipients": [
            {
                "emailAddress": {
                    "address": "hello@world.com"
                }
            }
        ]
    }
}
3052 commented

ah, the problem is the "spaces" in the input are No-Break Space U+00A0. looks like that's invalid for both the JavaScript parser and Go parser:

panic: invalid character '\u00a0' looking for beginning of value

so maybe its my error. might be good to warn the user though if NBSP are found in the input

Ha, wow. I've never seen that happen before but if it happens repeatedly maybe I'll add a quick warning... (or I'd accept a PR) 👍