This is kind of a silly question, but I haven't seen this mentioned anywhere and haven't been able to get it working on my own. If I create an XContentBuilder object, is it possible to retrieve values from that object?
Say I have:
val foo = jsonBuilder().startObject().field("foo", "bar").endObject()
Is it possible to retrieve foo's bar value without having to convert foo to a string and then parsing the JSON again?
XContentBuilder says it all. It's a builder, not a parser.
In XContentHelper, there is a helper method copyCurrentStructure for
copying a builder (generator) into a parser, so you can skip the string
materialization.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.