{ "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag"} ], "published":"2024-06-02T21:57:59.899Z", "attributedTo":"https://gopinath.org/actors/rahul", "replies":"https://gopinath.org/objects/zjgfTtk9IGc/replies", "to":["https://www.w3.org/ns/activitystreams#Public"], "cc":["https://gopinath.org/actors/rahul/followers"], "content":"
Parsing JSON is indeed a minefield. However, a commenter in HN has a suggestion: Use postscript instead of JSON. It has a binary format, has comments, and generally looks much better. Here is their provided example:
<<\r\n /first_name (John)\r\n /last_name (Smith)\r\n /is_alive true\r\n /age 27\r\n /phone_numbers [\r\n <<\r\n /type (home)\r\n /number (212 555-1234)\r\n >>\r\n <<\r\n /type (office)\r\n /number (646 555-4567)\r\n >>\r\n ]\r\n /spouse null\r\n >>
And I agree, it is much better than JSON. There are many other interesting things to like here. For one, the keys are symbolic. There is only one character `/` indicating the keys in a dictionary (indicated by `<<`). This reduces the visual clutter to a great extent. Using `<<` for dictionaries is also great. Dictionaries are one of the largest units in such formats containing data, and it is better to use two characters for their delimiters. By using `()` for strings, it provides a starting and ending delimiter for strings, and is better visually parsable than `\"`. There are no commas in arrays. or dictionaries, removing the question of trailing commas. Overall, PON (Postscript Object Notation) is much better designed than JSON for human readability.
", "mediaType":"text/html", "attachment":[], "type":"Note", "id":"https://gopinath.org/objects/zjgfTtk9IGc" }