Hello, currently I have a byte[] coming in that looks like
{
field1: value1 // could be any type
field2: "value2"
field3: smt_else
}
where both the field names and the value types are dynamic (they are
response from a database).
I have a set of all the field names (called names). Currently I'm using
both JsonGenerator and JsonParser like so
while (jParser.nextToken() != JsonToken.END_OBJECT) {
String dataFieldName = jParser.getCurrentName();
if (names.contains(dataFieldName)) {
jParser.nextToken();
jsonGenerator.writeStringField(dataFieldName,
jParser.getText());
}
}
This works fine but my generated json object's field values are all
Strings. I was wondering if there's a jsonGenerator.writeObject or a
jParser.getObject that will automatically pick up on what types it should
be reading or writing? I know there's already a writeObject and readObject
but those are more for POJO classes which won't work for due to the dynamic
nature of my response.
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/cfa9ac9f-4404-4806-afad-0179078ae9e8n%40googlegroups.com.