JSON - Accessing object with hypen/dash
If you encounter json object that have - (hypen/dash) in the key, you will get a reference error if you access the object with dot manner. For example
{"cam-id":"1"}
Assuming the above object is call json_results, you will get an reference error if you
json_results.cam-id
You have to access the value by
json_results["cam-id"]
Comments
Post a Comment