Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

<redacted>

I'll stick with JSON for one simple reason: you can have anything as a key (as long as it's escaped). The fact that this can't means you either a) can't use it if you have more-complex keys for some reason, or b) you have to use some non-standardized packing format to encode your illegal keys.

</redacted>

edit: thanks repliers, I missed part of the spec. Ignore!



Well if by anything you mean Strings, that is very limited.

   2.2.  Objects

   An object structure is represented as a pair of curly brackets
   surrounding zero or more name/value pairs (or members).  A name is a
   string.  A single colon comes after each name, separating the name
   from the value.  A single comma separates a value from a following
   name.  The names within an object SHOULD be unique.
http://www.ietf.org/rfc/rfc4627.txt


False. You can use anything as a key.

> Note that keys and values can be elements of any type.

The sample code also uses a vector as a key.


Ah, I missed that part. I was going off the keyword == symbol rules, which are waaaaay more restrictive. Thanks!


Did you read the spec? "... keys and values can be elements of any type".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: