Hacker News new | ask | show | jobs
by paragraft 4582 days ago
Its list handling seems broken? tojson(fromjson(x)) !== x.

Paste { "name": "John", "age": "29", "foo": [1,2,3] } into the JSON side, and click in the left and move the cursor to force it to update and see what happens (I see it drop the first two list items).

2 comments

Correct. We can turn all JSON to Space easily, but there's no canonical way to turn all Space into JSON (although you can do it easily for a particular use case).

Unlike JSON, in Space order is important and you can have duplicate properties. So in JSON you can't do this:

``` { 'h1' : 'hello world', 'h1' : 'this is a test', } ```

But you can do that in Space.

It can't handle lists. A spaces object is a JS object whose keys contain no newlines or spaces, whose string values contain no newlines, and whose non-string values are spaces objects (definitely not null/boolean/number/array).