Are there any forbidden characters in key names, for JavaScript objects or JSON strings? Or characters that need to be escaped?
To be more specific, I’d like to use “$”, “-” and space in key names.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. Any valid string is a valid key. It can even have
"as long as you escape it:There is perhaps a chance you’ll encounter difficulties loading such values into some languages, which try to associate keys with object field names. I don’t know of any such cases, however.