RDB/ETL

PDI java code json

세모데 2020. 8. 29. 20:49

1. class

org.json.simple Class

Description

JSONParser

This class parses JSON text

JSONValue

This class has methods to parse JSON string into Java objects

JSONObject

It's an unordered collection of name/value pairs

JSONArray

It's an ordered sequence of values

 

2. usage

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;

 

String contentStr = get(Fields.In, "test").getString(r);
JSONObject data = (JSONObject) JSONValue.parse(contentStr);

String name = (String) data.get("id");