-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonValue syntax tree #265
Comments
I'm not aware of any such things. |
well some times your data is fuzzy. think about bigdata processing, for instance, of an ingestion pattern |
just added a little PR demonstrating the feature: #267 |
I'm sure it might be useful to some people.
And
Or even your PR where you have
Anyway... I don't personally need that... but if many people do find that useful I don't mind merging PRs which setup some utilities to deal with JSON in such a way. Also, to keep in mind... "sparse" processing of JSON is already supported. If you are interested only in a subset of fields (from a known structure) you can just deserialize JSON into this smaller structure. Deserialization will ignore all the "unknown" fields by default. This does cover many similar use cases when people resort to such "low-level" inspection of the incoming structure. |
yes, I know, ADT is not supposed to be a general approach in this case, but it might be helpful in some scenarios. buy the way, separate from this discussion,
and I need to capture so eventually I need something like this
What would you recommend here? Thank you |
replying to your comment, I would say, and yes and no And don't take it as a criticism, I know a bunch of people who would accept this style of code, whereas others would prefer some more accurate and safe style where compiler is able to prevent accidental mistakes. |
Something like this should work
You must respect the JSON structure this way. Otherwise you would need custom converter to process metadata in a special way (eg, skip over the object/array/string). Of course its always better to make API feel safe and expected, as long as you are not compromising other goals. If someone wants to introduce something along those lines during or after the parsing I have no problems with that. |
Hi! I'm looking on how to get json (or it's part) parsed into a valid Json Value. Either it is an json object or json array or any other valid type.
I know today I can refer an
Object
type and parser will do the job by sending me a combination of lists and maps and primitives of all kinds. But what am I looking is rather something similar tocirce Json
orjsoniter Any
orjackson JsonNode
, something that would represent a json language.Why do I need it is because part of request that I parse has fuzzy structure and I don't know in advance what type of value is there. I can use
Object
, as I noticed earlier, but I don't want to keep it as abstract asObject
is.Can you suggest something?
PS: I also understand that I potentially can create my own hierarchy of classes or something and there is
@JsonConverter
that I could use to write my own parser, but I was wondering if there something similar that already exists.Thank you
The text was updated successfully, but these errors were encountered: