jsx
jsx copied to clipboard
nested raw json for encoder
Hi There!
Is it possible to have a inner part of an object encoded already, and jsx takes the inner part 'as is' when encoding the wrapping object ? like https://github.com/tophitpoker/mochijson3/blob/master/src/mochijson3.erl#L111
It seems the equivalent in jsx is {'raw', binary()} https://github.com/talentdeficit/jsx/blob/develop/src/jsx_parser.erl#L110 But the 'Raw' json is decoded there, then encoded back again later on. Is this to validate the raw part ?
What do you think if I add a {json, TrustedRaw} clause (or a trust_raw encoder config) ?
a trusted raw option would still have to be decoded because of the way jsx works internally.
all the valid input types are parsed into an AST that is then consumed by handlers. it would be possible to add a raw type to the AST but that would break all existing handlers so it would have to be in a 3.0 version
Hi,
I am actually looking at doing the exact same thing, I am building a json document out of other documents (already validated) and would like to avoid as much overhead as I can.
This seems more or less related to #119. @talentdeficit: did it make its way to 3.0?