comments JSON javascript
Problem:
Can you have comments in JSON?
Solution:
A discussion leading to the answer is on the Bytes IT forum.
Basically, though it's not defined in the JSON Grammar - on json.org - you can use slash-star /* ... */ comments to get most(?) javascript engines to ignore the comment text.
For example:
<script type="text/javascript"> var nested_arrays = { cities: [ ["Sydney", "Melbourne", "Canberra"] /* Australia */ , ["London", "Birmingham"] /* UK */ , ["Los Angeles", "New York"] /* US */ ] }; </script>
No comments:
Post a Comment