4 ms·
Space: A whitespace alternative to JSON
- ericingram 14y agoLooks interesting, are there any serious drawbacks from JSON?
- breck 14y agoGreat question. The simpler syntax reduces the number of rules to remember and shrinks the possible space for bugs. In back of the envelop user testing with non-programmers we've found people can pick up Space significantly faster than JSON. JSON is really popular. However, the number of people in the world who can read and write JSON is say, between 2-20 million. So a very small percentage of the people who could benefit from reading and writing structured data are currently doing so. Our thought with this is that perhaps if we can get enough adoption and developers involved over the next year or two we could enable a lot more people to collaborate on the web.
- luisbebop 14y agoamazing. simple and efficient. better than json.
- rjempson 14y agoWhat happens if the data has spaces in it or new lines in it? in other words, how do you escape a space / new line?
- breck 14y agoSpaces are not a problem in values and need no escape. To escape a newline in a value, just indent it appropriately. For example: myKey this is a multiline string and the indent on this line indicates that. It can even be 3 lines long :) someOtherKey and now this is a separate key/value pair. Like URLs, new lines and spaces are not allowed in keys.
- kissmd 14y agowhat about arrays? what if i paste this in a html and you want to copy it? all your spaces will be stripped. nice thought anyway.
- breck 14y agoThe underlying data structure of Space is an associate array, like in PHP. So Space objects are both hash tables and arrays. For example say you had a variable named account with the space value: charges coffee $2.12 soda $1.21 cupcake $2.50 You could access the individual elements of this object like you would a hash table: account.get('charges soda') // Returns $1.21 Or like an array: account.get('charges').get(1) // Returns $1.21
- malandrew 14y agoIsn't this counter to the original purpose of JSON: serialization. Without braces and quotes, or similar syntax, you can't minify this for transfer over a low bandwidth, high latency connection.
- breck 14y agoI'm not sure how you couldn't minify this compared to JSON? Could you provide an example?