Home > Back-end >  Get value from String-Json object
Get value from String-Json object

Time:06-16

I have big String (which is not converted JSON):

{
  "MyType" : "5",
  "creationTime" : "06/03/2021 11:14:37",
  "entityCompositeKey" : "3001v4",
  ...
}

which another thousand lines.

I am only interested in value which is in MyType, I don't care about other values.

JSONObject jsonObj = new JSONObject(view);
String chiupType = jsonObj.get("MyType").toString();

but it's way too slow. What is the fastest way to get only one value from String(JSON)?

CodePudding user response:

In the implementation, the whole JSON string is processed directly after the constructor has been called. Thus, there is no possibility to read out only a single value.

  • Related