Class JsonObject
java.lang.Object
org.apache.jackrabbit.oak.commons.json.JsonObject
Simple JSON Object representation.
It optionally supports respecting the order of properties, and the order children.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a Json object that doesn't respect the order.JsonObject
(boolean respectOrder) Create a Json object. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonObject
Reads a JSON object from the given tokenizer.static JsonObject
create
(JsopTokenizer t, boolean respectOrder) Reads a JSON object from the given tokenizer.static JsonObject
Build a Json object from a String.Get the (mutable) map of children.Get the (mutable) map of properties.void
toJson
(JsopBuilder buf) Write the object to a builder.toString()
Pretty-print the object.
-
Constructor Details
-
JsonObject
public JsonObject()Create a Json object that doesn't respect the order. -
JsonObject
public JsonObject(boolean respectOrder) Create a Json object.- Parameters:
respectOrder
- whether the object should respect the order
-
-
Method Details
-
fromJson
Build a Json object from a String.- Parameters:
json
- the json stringrespectOrder
- whether the object should respect the child order- Returns:
- the json object
-
create
Reads a JSON object from the given tokenizer. The opening '{' of the object should already have been consumed from the tokenizer before this method is called.- Parameters:
t
- tokenizerrespectOrder
- whether the order should be respected- Returns:
- JSON object
-
create
Reads a JSON object from the given tokenizer. The opening '{' of the object should already have been consumed from the tokenizer before this method is called.- Parameters:
t
- tokenizer- Returns:
- JSON object
-
toJson
Write the object to a builder.- Parameters:
buf
- the target
-
getProperties
Get the (mutable) map of properties.- Returns:
- the property map
-
getChildren
Get the (mutable) map of children.- Returns:
- the children map
-
toString
Pretty-print the object.
-