Converting JSON data to Java object

后端 未结 12 1336
春和景丽
春和景丽 2020-11-21 05:11

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson()

12条回答
  •  南旧
    南旧 (楼主)
    2020-11-21 05:43

    Give boon a try:

    https://github.com/RichardHightower/boon

    It is wicked fast:

    https://github.com/RichardHightower/json-parsers-benchmark

    Don't take my word for it... check out the gatling benchmark.

    https://github.com/gatling/json-parsers-benchmark

    (Up to 4x is some cases, and out of the 100s of test. It also has a index overlay mode that is even faster. It is young but already has some users.)

    It can parse JSON to Maps and Lists faster than any other lib can parse to a JSON DOM and that is without Index Overlay mode. With Boon Index Overlay mode, it is even faster.

    It also has a very fast JSON lax mode and a PLIST parser mode. :) (and has a super low memory, direct from bytes mode with UTF-8 encoding on the fly).

    It also has the fastest JSON to JavaBean mode too.

    It is new, but if speed and simple API is what you are looking for, I don't think there is a faster or more minimalist API.

提交回复
热议问题