Package org.jfree.data.json
Class JSONUtils
- java.lang.Object
-
- org.jfree.data.json.JSONUtils
-
public class JSONUtils extends java.lang.ObjectA utility class that can read and write data in specific JSON formats.
-
-
Constructor Summary
Constructors Constructor Description JSONUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringwriteKeyedValues(KeyedValues data)Returns a string containing the data in JSON format.static voidwriteKeyedValues(KeyedValues data, java.io.Writer writer)Writes the data in JSON format to the supplied writer.static java.lang.StringwriteKeyedValues2D(KeyedValues2D data)Returns a string containing the data in JSON format.static voidwriteKeyedValues2D(KeyedValues2D data, java.io.Writer writer)Writes the data in JSON format to the supplied writer.
-
-
-
Method Detail
-
writeKeyedValues
public static java.lang.String writeKeyedValues(KeyedValues data)
Returns a string containing the data in JSON format. The format is an array of arrays, where each sub-array represents one data value. The sub-array should contain two items, first the item key as a string and second the item value as a number. For example:[["Key A", 1.0], ["Key B", 2.0]]
Note that this method can be used with instances ofPieDataset.- Parameters:
data- the data (nullnot permitted).- Returns:
- A string in JSON format.
-
writeKeyedValues
public static void writeKeyedValues(KeyedValues data, java.io.Writer writer) throws java.io.IOException
Writes the data in JSON format to the supplied writer.
Note that this method can be used with instances ofPieDataset.- Parameters:
data- the data (nullnot permitted).writer- the writer (nullnot permitted).- Throws:
java.io.IOException- if there is an I/O problem.
-
writeKeyedValues2D
public static java.lang.String writeKeyedValues2D(KeyedValues2D data)
Returns a string containing the data in JSON format. The format is...
Note that this method can be used with instances ofCategoryDataset.- Parameters:
data- the data (nullnot permitted).- Returns:
- A string in JSON format.
-
writeKeyedValues2D
public static void writeKeyedValues2D(KeyedValues2D data, java.io.Writer writer) throws java.io.IOException
Writes the data in JSON format to the supplied writer.
Note that this method can be used with instances ofCategoryDataset.- Parameters:
data- the data (nullnot permitted).writer- the writer (nullnot permitted).- Throws:
java.io.IOException- if there is an I/O problem.
-
-