Class JSONUtil
java.lang.Object
de.uplanet.lucy.server.auxiliaries.JSONUtil
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA builder to create JSON output.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateBuilder(Writer p_writer, boolean p_bAutoEnableWrite) Create a JSON builder.de.uplanet.lucy.server.auxiliaries.net.HttpRequestCreate a JSON HTTP request object.Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).org.json.simple.JSONArraynewArray()Create a new JSON array.org.json.simple.JSONObjectCreate a new JSON object.org.json.simple.JSONObjectCreate a new JSON object.Parse a JSON object from a character stream.parse(CharSequence p_chseq) Parse a JSON object from a character sequence.parseFromFile(String p_strPath) Parse a JSON object from a file.toJSONString(Object p_value) Convert an object to a JSON string.voidConvert an object to a JSON string and write it to a character stream.voidwriteJSONString(Object p_value, Writer p_writer) Deprecated.
- 
Constructor Details- 
JSONUtilpublic JSONUtil()
 
- 
- 
Method Details- 
newObjectpublic org.json.simple.JSONObject newObject()Create a new JSON object.- Returns:
- The new object.
 
- 
newObjectCreate a new JSON object.- Parameters:
- p_map- A map that represents the JSON object.
- Returns:
- The new object.
 
- 
newArraypublic org.json.simple.JSONArray newArray()Create a new JSON array.- Returns:
- The new array.
 
- 
escapeEscape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).- Parameters:
- p_strValue- The string to be escaped.
- Returns:
- The string with escaped characters.
 
- 
toJSONStringConvert an object to a JSON string.- Parameters:
- p_value- The object.
- Returns:
- The object in JSON serialized form.
 
- 
writeJSONStringDeprecated.UsewriteJSON(Writer, Object)instead.- Throws:
- IOException
 
- 
writeJSONConvert an object to a JSON string and write it to a character stream.- Parameters:
- p_writer- The output stream.
- p_value- The object.
- Throws:
- IOException
 
- 
createBuilderCreate a JSON builder.This is the most flexible way to create JSON output from a variety of input data. If the parameter p_bAutoEnableWriteistruethe builder will automatically enable and disable writing on the underlying stream if the stream had previously put in the ignore-write mode.- Parameters:
- p_writer- The output stream.
- p_bAutoEnableWrite-- trueif the builder should manage writing on the underlying stream, or- falseotherwise.
- Returns:
- A JSON builder that writes to the given output stream.
- Since:
- Intrexx 7.0
 
- 
parseParse a JSON object from a character stream.- Parameters:
- p_reader- The input stream.
- Returns:
- An instance of the following:
 - org.json.simple.JSONObject,
- org.json.simple.JSONArray,
- java.lang.String,
- java.lang.Number,
- java.lang.Boolean, or
- null.
 
 
- 
parseParse a JSON object from a character sequence.- Parameters:
- p_chseq- The text input.
- Returns:
- An instance of the following:
 - org.json.simple.JSONObject,
- org.json.simple.JSONArray,
- java.lang.String,
- java.lang.Number,
- java.lang.Boolean, or
- null.
 
 
- 
parseFromFilepublic Object parseFromFile(String p_strPath) throws IOException, org.json.simple.parser.ParseException Parse a JSON object from a file.- Parameters:
- p_strPath- The path to the file to be parsed.
- Returns:
- An instance of the following:
 - org.json.simple.JSONObject,
- org.json.simple.JSONArray,
- java.lang.String,
- java.lang.Number,
- java.lang.Boolean, or
- null.
 
- Throws:
- org.json.simple.parser.ParseException- If the given input could not be parsed as JSON.
- IOException- If an I/O error occurred.
 
- 
createJSONHttpRequestpublic de.uplanet.lucy.server.auxiliaries.net.HttpRequest createJSONHttpRequest()Create a JSON HTTP request object.- Returns:
- A JSON HTTP request object.
 
 
- 
writeJSON(Writer, Object)instead.