public class Json
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DFLT_QUOTE
default quote value
|
static java.lang.String |
FIELD_DATA
_more_
|
static java.lang.String |
FIELD_DATE
_more_
|
static java.lang.String |
FIELD_ELEVATION
_more_
|
static java.lang.String |
FIELD_FIELDS
_more_
|
static java.lang.String |
FIELD_LATITUDE
_more_
|
static java.lang.String |
FIELD_LONGITUDE
_more_
|
static java.lang.String |
FIELD_NAME
_more_
|
static java.lang.String |
FIELD_VALUES
_more_
|
static java.lang.String |
MIMETYPE
JSON MIME type
|
static java.lang.String |
NULL
the null string identifier
|
Constructor and Description |
---|
Json() |
Modifier and Type | Method and Description |
---|---|
static void |
addGeolocation(java.lang.Appendable pw,
double lat,
double lon,
double elevation)
_more_
|
static void |
attr(java.util.List<java.lang.String> items,
java.lang.String name,
java.lang.String value)
Make an attribute and add it to the list
|
static java.lang.String |
attr(java.lang.String name,
double value)
_more_
|
static java.lang.String |
attr(java.lang.String name,
long value)
_more_
|
static java.lang.String |
attr(java.lang.String name,
java.lang.String value)
Create a JSON object attribute
|
static java.lang.String |
attr(java.lang.String name,
java.lang.String value,
boolean quoteValue)
Create a JSON object attribute
|
static java.lang.String |
cleanString(java.lang.String aText)
Clean a string of illegal JSON characters
|
static java.lang.String |
formatNumber(double d)
_more_
|
static java.lang.String |
getString(java.lang.String s,
boolean quote)
Get a string
|
static java.lang.String |
list(java.util.List values)
Create a JSON list from the array of strings
|
static java.lang.String |
list(java.util.List values,
boolean quoteValue)
Create a JSON list from the array of strings
|
static java.lang.String |
list(java.lang.String[] values)
Create a JSON list from the array of strings
|
static java.lang.String |
listClose()
_more_
|
static java.lang.String |
listOpen()
_more_
|
static void |
main(java.lang.String[] args)
_more_
|
static java.lang.String |
map(java.util.List<java.lang.String> values)
Create a JSON map
|
static java.lang.String |
map(java.util.List<java.lang.String> values,
boolean quoteValue)
Create a JSON map
|
static java.lang.String |
map(java.lang.String... values)
Create a JSON map
|
static java.lang.String |
map(java.lang.String[] values,
boolean quoteValue)
Create a JSON map
|
static java.lang.String |
mapAndQuote(java.util.List<java.lang.String> values)
_more_
|
static java.lang.String |
mapAndQuote(java.lang.String... values)
Create a JSON map
|
static java.lang.String |
mapClose()
_more_
|
static java.lang.String |
mapKey(java.lang.String key)
_more_
|
static java.lang.String |
mapOpen()
_more_
|
static java.lang.String |
quote(java.lang.String s)
Quote a string
|
static void |
quoteAttr(java.util.List<java.lang.String> items,
java.lang.String name,
java.lang.String value)
quote the attribute value and add it to the list
|
static java.lang.String |
tfoList(java.util.List<TwoFacedObject> values)
Create a list of JSON object from a list of TwoFacedObjects
|
static java.lang.String |
tfoList(java.util.List<TwoFacedObject> values,
java.lang.String idKey,
java.lang.String labelKey)
Create a list of JSON object from a list of TwoFacedObjects
|
public static final java.lang.String MIMETYPE
public static final java.lang.String NULL
public static final boolean DFLT_QUOTE
public static final java.lang.String FIELD_NAME
public static final java.lang.String FIELD_FIELDS
public static final java.lang.String FIELD_DATA
public static final java.lang.String FIELD_VALUES
public static final java.lang.String FIELD_LATITUDE
public static final java.lang.String FIELD_LONGITUDE
public static final java.lang.String FIELD_ELEVATION
public static final java.lang.String FIELD_DATE
public static void addGeolocation(java.lang.Appendable pw, double lat, double lon, double elevation) throws java.lang.Exception
pw
- _more_lat
- _more_lon
- _more_elevation
- _more_java.lang.Exception
- _more_public static java.lang.String mapAndQuote(java.lang.String... values)
values
- key/value pairs { key1,value1,key2,value2 }public static java.lang.String map(java.lang.String... values)
values
- key/value pairs { key1,value1,key2,value2 }public static java.lang.String map(java.util.List<java.lang.String> values)
values
- key/value pairs [ key1,value1,key2,value2 ]public static java.lang.String mapAndQuote(java.util.List<java.lang.String> values)
values
- _more_public static java.lang.String map(java.lang.String[] values, boolean quoteValue)
values
- key/value pairs { key1,value1,key2,value2 }quoteValue
- true to quote the valuespublic static java.lang.String map(java.util.List<java.lang.String> values, boolean quoteValue)
values
- key/value pairs [ key1,value1,key2,value2 ]quoteValue
- true to quote the valuespublic static java.lang.String list(java.lang.String[] values)
values
- list of values { value1,value2,value3,value4 }public static java.lang.String list(java.util.List values)
values
- list of values [ value1,value2,value3,value4 ]public static java.lang.String mapKey(java.lang.String key)
key
- _more_public static java.lang.String mapOpen()
public static java.lang.String mapClose()
public static java.lang.String listOpen()
public static java.lang.String listClose()
public static java.lang.String list(java.util.List values, boolean quoteValue)
values
- list of values [ value1,value2,value3,value4 ]quoteValue
- true to quote the valuespublic static java.lang.String tfoList(java.util.List<TwoFacedObject> values)
values
- the valuespublic static java.lang.String tfoList(java.util.List<TwoFacedObject> values, java.lang.String idKey, java.lang.String labelKey)
values
- the valuesidKey
- the key for the TwoFacedObject IDlabelKey
- the key for the TwoFacedObject labelpublic static java.lang.String getString(java.lang.String s, boolean quote)
s
- the stringquote
- true to quotepublic static java.lang.String attr(java.lang.String name, double value)
name
- _more_value
- _more_public static java.lang.String attr(java.lang.String name, long value)
name
- _more_value
- _more_public static java.lang.String attr(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the attribute valuepublic static java.lang.String attr(java.lang.String name, java.lang.String value, boolean quoteValue)
name
- the attribute namevalue
- the attribute valuequoteValue
- true to quote the name and valuepublic static void quoteAttr(java.util.List<java.lang.String> items, java.lang.String name, java.lang.String value)
items
- the list of itemsname
- the attribute namevalue
- the attribute valuepublic static void attr(java.util.List<java.lang.String> items, java.lang.String name, java.lang.String value)
items
- the list of name/value pairsname
- the attribute namevalue
- the attribute valuepublic static java.lang.String formatNumber(double d)
d
- _more_public static java.lang.String quote(java.lang.String s)
s
- the stringpublic static java.lang.String cleanString(java.lang.String aText)
aText
- the stringpublic static void main(java.lang.String[] args)
args
- _more_