-
Notifications
You must be signed in to change notification settings - Fork 6
Update the JSON codecs to be able to encode/decode any EJSON values #19
Comments
@garyb There isn't any spec that I know of, @sellout and I came up with the following encoding last week: All
we had also considered encoding maps like If a Also, when encoding What do you think? |
Why is this necessary? It should be unambiguous if you are losslessly encoding information at every level of the hierarchy. |
Oh, I see why, this:
The alternative is to encode these as well, e.g. |
@jdegoes Indeed, we could do that instead. The thought behind the proposed encoding is that treating the extended parts as a strict super set of I should also add that a |
@wemrysi Either way is fine with me, and you've probably already thought about this, but if a key is |
@jdegoes Ah, yes, you're right. I think if a key begins with a |
@jdegoes Yeah, not encoding the compatible parts for a few reasons:
The last point is because I imagine we can end up with mixed JSON/EJson collections and so that means we will always have to guess in some cases (since JSON-encoded EJson has to be parsable as valid JSON). Oh, but this raises a counterpoint for always encoding (like [†]: Because of the |
@wemrysi the proposed encoding looks great to me! I have no particular preference on using an array/object for key-value pairs. Would this replace the current "precise" encoding? We've actually just dropped some of the type information (for dates, etc) from our |
@garyb I was thinking that this would be something like |
Ok great. And yeah, I think when there is an |
Some candidates might be, Any preferences? |
|
@wemrysi do you know where this is up to? Is there an |
@garyb There is not, the encoding is implemented in Quasar, but we ended up not exposing it in the REST api and used the existing |
Ok, thanks. |
Currently we have silly things like
arbitraryJsonEncodableEJsonOfSize
, which just wasted about half an hour of @kritzcreek's and my time. 😢@wemrysi this is relevant to our discussion about SST EJSON encoding the other day - I'm not sure at the moment what the encoding of non-string-key maps is supposed to look like. I asked @jdegoes about it in #general a while back, and I think the idea was the encoding would be something like
{ $map: [{ $key: ..., $value: ... }] }
, but I don't know if that is already the case or if it was a proposal for how it should be done. Can you take a look and let us know so we can update this accordingly? I tried to find it myself but was a bit lost. 😄The text was updated successfully, but these errors were encountered: