Hacker News new | ask | show | jobs
by j16sdiz 987 days ago
> Some Google protobufs had thousands of optional fields so the wire format became: > [null,null,null,null,...many times over...,null,"foo"]

In pblite, they are serialized as `[,,,,...many times over...,,"foo"]`. Just comma, no "null".

1 comments

    > JSON.parse('[null,null,null]')
    > (3) [null, null, null]
    > JSON.parse('[,,,]')
    Uncaught SyntaxError...
Maybe eventually someone realized this was horribly inefficient and added an extra step but a series of commas in an array with nothing in between them isn't valid JSON.