public class JsObj extends Object implements Json<JsObj>, Iterable<JsObjPair>
Instances of this class are immutable and persistent, meaning that once created, the contents of a `JsObj` cannot be modified. Instead, operations on `JsObj` instances return new `JsObj` instances with the desired changes, leaving the original object unchanged. This immutability makes `JsObj` a persistent data structure.
This class provides methods to access and manipulate JSON data stored within it, including querying values by key, performing intersections with other `JsObj` instances, and converting the `JsObj` to a JSON string.
It also offers a convenient and functional way to work with JSON data in Java, making it easy to create and manipulate JSON objects programmatically.
Example usage:
// Create a JsObj with key-value pairs
JsObj person = JsObj.of("name", "Alice", "age", 30, "city", "New York");
// Access values by key
String name = person.getStr("name"); // "Alice"
int age = person.getInt("age"); // 30
// Create a new JsObj with additional data
JsObj updatedPerson = person.set("isStudent", true);
// Perform an intersection with another JsObj
JsObj otherPerson = JsObj.of("name", "Alice", "city", "London");
JsObj commonData = person.intersection(otherPerson, JsObj.TYPE.SET);
Modifier and Type | Field and Description |
---|---|
static JsOptics.JsObjLenses |
lens
Using the
lens field, you can apply various optical operations to JsObj instances
in a functional and declarative manner, making it easier to modify or query the content of a
JsObj |
static JsOptics.JsObjOptional |
optional
Using the
optional field, you can apply optional optics to JsObj instances in a functional
and declarative manner. |
static fun.optic.Prism<JsValue,JsObj> |
prism
A Prism that allows you to view a
JsValue as a JsObj if it represents an object, or as an empty optional if it's not an object. |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Checks if the specified key exists in the JSON object.
|
boolean |
containsValue(JsValue el)
Checks if this JSON contains the given value in its first level.
|
JsObj |
delete(JsPath path)
Removes the element at the specified path within this immutable JSON object, if it exists.
|
JsObj |
delete(String key)
Deletes the specified key from the JSON object.
|
static JsObj |
empty()
Returns the singleton empty JSON object
|
boolean |
equals(JsObj that,
JsArray.TYPE ARRAY_AS)
Checks if this `JsObj` is equal to another `JsObj` considering how arrays are treated (as lists, sets, or multisets).
|
boolean |
equals(Object o) |
JsObj |
filterKeys(BiPredicate<? super JsPath,? super JsValue> filter)
Filters all the keys of this json, removing those that don't satisfy the given predicate.
|
JsObj |
filterKeys(Predicate<? super String> filter)
Filters all the keys of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterObjs(BiPredicate<? super JsPath,? super JsObj> filter)
Filters all the pair of jsons of this json, removing those that don't satisfy the given predicate.
|
JsObj |
filterObjs(Predicate<? super JsObj> filter)
Filters all the pair of jsons of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterValues(BiPredicate<? super JsPath,? super JsPrimitive> filter)
Filters all the pairs of elements of this json, removing those that don't satisfy the given predicate.
|
JsObj |
filterValues(Predicate<? super JsPrimitive> filter)
Filters all the pairs of elements of this json, removing those that don't ifPredicateElse the predicate.
|
JsValue |
get(JsPath path)
Gets the value located at the given path or
JsNothing if it doesn't exist. |
JsValue |
get(String key)
Retrieves the JSON value associated with the specified key.
|
JsArray |
getArray(String key)
Returns the array located at the given key or null if it doesn't exist, or it's not an array.
|
JsArray |
getArray(String key,
Supplier<JsArray> orElse)
Returns the array located at the given key or the default value provided if it
doesn't exist, or it's not an array.
|
BigDecimal |
getBigDec(String key)
Returns the number located at the given key as a big decimal or null if it doesn't exist or it's
not a decimal number.
|
BigDecimal |
getBigDec(String key,
Supplier<BigDecimal> orElse)
Returns the number located at the given key as a big decimal or the default value provided
if it doesn't exist, or it's not a decimal number.
|
BigInteger |
getBigInt(String key)
Returns the big integer located at the given key as a big integer or null if it doesn't
exist, or it's not an integral number.
|
BigInteger |
getBigInt(String key,
Supplier<BigInteger> orElse)
Returns the big integer located at the given key as a big integer or the default value provided
if it doesn't exist, or it's not an integral number.
|
byte[] |
getBinary(String key)
Returns the bytes located at the given key or null if it doesn't exist, or it's
not an array of bytes.
|
byte[] |
getBinary(String key,
Supplier<byte[]> orElse)
Returns the bytes located at the given key or the default value provided if it doesn't exist,
or it's not an array of bytes.
|
Boolean |
getBool(String key)
Returns the boolean located at the given key or null if it doesn't exist.
|
Boolean |
getBool(String key,
Supplier<Boolean> orElse)
Returns the boolean located at the given key or the default value provided if it doesn't exist.
|
Double |
getDouble(String key)
Returns the number located at the given key as a double or null if it
doesn't exist, or it's not a decimal number.
|
Double |
getDouble(String key,
Supplier<Double> orElse)
Returns the number located at the given key as a double or the default value provided if it
doesn't exist, or it's not a decimal number.
|
Instant |
getInstant(String key)
Returns the instant located at the given key or null if it doesn't exist, or it's
not an instant.
|
Instant |
getInstant(String key,
Supplier<Instant> orElse)
Returns the instant located at the given key or the default value provided if it doesn't
exist, or it's not an instant.
|
Integer |
getInt(String key)
Returns the integral number located at the given key as an integer or null if it
doesn't exist, or it's not an integral number or it's an integral number but doesn't fit in an integer.
|
Integer |
getInt(String key,
Supplier<Integer> orElse)
Returns the integral number located at the given key as an integer or the default value provided if it
doesn't exist, or it's not an integral number or it's an integral number but doesn't fit in an integer.
|
Long |
getLong(String key)
Returns the integral number located at the given key as a long or null if it
doesn't exist, or it's not an integral number or it's an integral number but doesn't fit in a long.
|
Long |
getLong(String key,
Supplier<Long> orElse)
Returns the integral number located at the given key as a long or the default value provided
if it doesn't exist, or it's not an integral number or it's an integral number but doesn't fit
in a long.
|
JsObj |
getObj(String key)
Returns the json object located at the given key or null if it doesn't exist or it's not an object.
|
JsObj |
getObj(String key,
Supplier<JsObj> orElse)
Returns the json object located at the given key or the default value provided
if it doesn't exist, or it's not an object.
|
String |
getStr(String key)
Returns the string located at the given key or null if it doesn't exist or it's not an string.
|
String |
getStr(String key,
Supplier<String> orElse)
Returns the string located at the given key or the default value provided if it doesn't
exist, or it's not an string.
|
int |
hashCode() |
JsObj |
intersection(JsObj that,
JsArray.TYPE ARRAY_AS)
Computes the intersection of this JSON and another JSON object 'that' with respect to the given array merging strategy.
|
boolean |
isEmpty()
Determines whether this Json instance is empty, i.e., it contains no elements.
|
boolean |
isObj()
Returns true if this JsValue is a JsObj.
|
Iterator<JsObjPair> |
iterator() |
Set<String> |
keySet()
Returns a `Set` of all keys present in the JSON object.
|
JsObj |
mapKeys(BiFunction<? super JsPath,? super JsValue,String> fn)
Maps all the keys of this JSON object, recursively traversing the entire JSON structure.
|
JsObj |
mapKeys(Function<? super String,String> fn)
Maps all the keys of this JSON object, recursively traversing the entire JSON structure.
|
JsObj |
mapObjs(BiFunction<? super JsPath,? super JsObj,? extends JsValue> fn)
Maps all the JSON objects of this JSON, traversing the entire JSON if necessary.
|
JsObj |
mapObjs(Function<? super JsObj,? extends JsValue> fn)
Maps all the JSON objects of this JSON, traversing the entire JSON if necessary.
|
JsObj |
mapValues(BiFunction<? super JsPath,? super JsPrimitive,? extends JsValue> fn)
Recursively maps all the values of this JSON, replacing each value with the result of applying the given mapping function.
|
JsObj |
mapValues(Function<? super JsPrimitive,? extends JsValue> fn)
Recursively maps all the values of this JSON, replacing each value with the result of applying the given mapping function.
|
static JsObj |
of(JsPath path,
JsValue el)
Static factory method to create one-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2)
Static factory method to create two-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3)
Static factory method to create three-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4)
Static factory method to create four-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5)
Static factory method to create five-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6)
Static factory method to create six-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7)
Static factory method to create seven-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8)
Static factory method to create eight-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9)
Static factory method to create nine-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10)
Static factory method to create ten-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11)
Static factory method to create eleven-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12)
Static factory method to create twelve-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13)
Static factory method to create thirteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14)
Static factory method to create fourteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15)
Static factory method to create fifteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16)
Static factory method to create sixteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17)
Static factory method to create seventeen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18)
Static factory method to create eighteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18,
JsPath path19,
JsValue el19)
Static factory method to create nineteen-element JSON object
|
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18,
JsPath path19,
JsValue el19,
JsPath path20,
JsValue el20)
Static factory method to create twenty-element JSON object
|
static JsObj |
of(String key,
JsValue el)
Static factory method to create one-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2)
Static factory method to create two-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3)
Static factory method to create three-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4)
Static factory method to create four-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5)
Static factory method to create five-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6)
Static factory method to create six-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7)
Static factory method to create seven-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8)
Static factory method to create eight-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9)
Static factory method to create nine-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10)
Static factory method to create ten-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11)
Static factory method to create eleven-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12)
Static factory method to create twelve-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13)
Static factory method to create thirteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14)
Static factory method to create fourteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15)
Static factory method to create fifteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16)
Static factory method to create sixteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17)
Static factory method to create seventeen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18)
Static factory method to create eighteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19)
Static factory method to create nineteen-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20)
Static factory method to create twenty-element JSON object
|
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24,
String key25,
JsValue el25) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24,
String key25,
JsValue el25,
String key26,
JsValue el26) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24,
String key25,
JsValue el25,
String key26,
JsValue el26,
String key27,
JsValue el27) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24,
String key25,
JsValue el25,
String key26,
JsValue el26,
String key27,
JsValue el27,
String key28,
JsValue el28) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20,
String key21,
JsValue el21,
String key22,
JsValue el22,
String key23,
JsValue el23,
String key24,
JsValue el24,
String key25,
JsValue el25,
String key26,
JsValue el26,
String key27,
JsValue el27,
String key28,
JsValue el28,
String key29,
JsValue el29) |
static JsObj |
parse(byte[] bytes)
Parses the given array of bytes into an immutable and persistent JSON object.
|
static JsObj |
parse(String str)
Parses the given string into an immutable and persistent JSON object.
|
<R> Optional<R> |
reduce(BinaryOperator<R> op,
BiFunction<? super JsPath,? super JsPrimitive,R> map,
BiPredicate<? super JsPath,? super JsPrimitive> predicate)
Reduces the values of this JSON object that satisfy the given predicate, allowing access to the element's path.
|
<R> Optional<R> |
reduce(BinaryOperator<R> op,
Function<? super JsPrimitive,R> map,
Predicate<? super JsPrimitive> predicate)
Reduces the values of this JSON object that satisfy the given predicate.
|
JsObj |
set(JsPath path,
JsValue element)
Inserts the given element at the specified path in this JSON, replacing any existing element.
|
JsObj |
set(JsPath path,
JsValue value,
JsValue padElement)
Inserts an element at the specified path in this JSON, replacing any existing element.
|
JsObj |
set(String key,
JsValue value)
Sets the specified key to the given JSON value.
|
int |
size()
Returns the number of elements in the first level of this JSON object or array.
|
Stream<JsPair> |
stream()
Returns a stream over all the key-value pairs
JsPair of elements in this JSON object. |
Stream<JsObjPair> |
streamOfKeys()
Returns a stream of `(key, value)` pairs representing the properties of the JSON object at the first level.
|
String |
toString() |
JsObj |
union(JsObj that,
JsArray.TYPE ARRAY_AS)
Computes the union of this JSON and another JSON object 'that' with respect to the given array merging strategy.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsPath, equals, getArray, getArray, getBigDec, getBigDec, getBigInt, getBigInt, getBinary, getBinary, getBool, getBool, getDouble, getDouble, getInstant, getInstant, getInt, getInt, getLong, getLong, getObj, getObj, getStr, getStr, ifEmptyElse, isNotEmpty, serialize, serialize, toJsPrimitive, toPrettyString, toPrettyString
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isPrimitive, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
forEach, spliterator
public static final JsOptics.JsObjLenses lens
lens
field, you can apply various optical operations to JsObj
instances
in a functional and declarative manner, making it easier to modify or query the content of a
JsObj
public static final JsOptics.JsObjOptional optional
Using the optional
field, you can apply optional optics to JsObj
instances in a functional
and declarative manner. These optics allow you to safely retrieve and modify fields that may or may not be present
in the JsObj
, helping you avoid null pointer exceptions and handle optional values gracefully.
public static final fun.optic.Prism<JsValue,JsObj> prism
JsValue
as a JsObj
if it represents an object, or as an empty optional if it's not an object.
Prisms are a functional optic that can be used to safely extract a specific type from a more general type, or to construct a more general type from a specific type. In this case, the prism
field allows you to view a JsValue
as a JsObj
only if it represents an object, and returns an empty optional if the JsValue
is not an object.
This Prism is useful for safely handling and processing JSON data, ensuring that you only work with objects when you expect them to be objects.
public static JsObj empty()
public static JsObj of(String key, JsValue el)
public static JsObj of(JsPath path, JsValue el)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18, JsPath path19, JsValue el19)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24, String key25, JsValue el25)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24, String key25, JsValue el25, String key26, JsValue el26)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24, String key25, JsValue el25, String key26, JsValue el26, String key27, JsValue el27)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24, String key25, JsValue el25, String key26, JsValue el26, String key27, JsValue el27, String key28, JsValue el28)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20, String key21, JsValue el21, String key22, JsValue el22, String key23, JsValue el23, String key24, JsValue el24, String key25, JsValue el25, String key26, JsValue el26, String key27, JsValue el27, String key28, JsValue el28, String key29, JsValue el29)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18, JsPath path19, JsValue el19, JsPath path20, JsValue el20)
public static JsObj parse(String str) throws JsParserException
str
- the string to be parsedJsParserException
- if the string doesn't represent a json objectpublic static JsObj parse(byte[] bytes) throws JsParserException
bytes
- the array of bytesJsParserException
- if the string doesn't represent a json objectpublic JsObj set(String key, JsValue value)
key
- The key to set.value
- The JSON value to associate with the key.public JsObj delete(String key)
key
- The key to delete.public boolean containsValue(JsValue el)
Json
containsValue
in interface Json<JsObj>
el
- The value to check for.public Set<String> keySet()
public JsValue get(JsPath path)
Json
JsNothing
if it doesn't exist.public JsObj filterValues(BiPredicate<? super JsPath,? super JsPrimitive> filter)
Json
filterValues
in interface Json<JsObj>
filter
- the predicate which takes as input every JsPair of this jsonpublic JsObj filterValues(Predicate<? super JsPrimitive> filter)
Json
filterValues
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterKeys(BiPredicate<? super JsPath,? super JsValue> filter)
Json
filterKeys
in interface Json<JsObj>
filter
- the predicate which takes as input every JsPair of this jsonpublic JsObj filterKeys(Predicate<? super String> filter)
Json
filterKeys
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterObjs(BiPredicate<? super JsPath,? super JsObj> filter)
Json
filterObjs
in interface Json<JsObj>
filter
- the predicate which takes as input every JsPair of this jsonpublic JsObj filterObjs(Predicate<? super JsObj> filter)
Json
filterObjs
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic boolean isEmpty()
Json
public JsObj mapValues(BiFunction<? super JsPath,? super JsPrimitive,? extends JsValue> fn)
Json
public JsObj mapValues(Function<? super JsPrimitive,? extends JsValue> fn)
Json
public JsObj mapKeys(BiFunction<? super JsPath,? super JsValue,String> fn)
Json
public JsObj mapKeys(Function<? super String,String> fn)
Json
public JsObj mapObjs(BiFunction<? super JsPath,? super JsObj,? extends JsValue> fn)
Json
public JsObj mapObjs(Function<? super JsObj,? extends JsValue> fn)
Json
public JsObj set(JsPath path, JsValue value, JsValue padElement)
Json
public JsObj set(JsPath path, JsValue element)
Json
JsNull
. You have the option to use
Json.set(JsPath, JsValue, JsValue)
to specify a custom padding element.public <R> Optional<R> reduce(BinaryOperator<R> op, BiFunction<? super JsPath,? super JsPrimitive,R> map, BiPredicate<? super JsPath,? super JsPrimitive> predicate)
Json
reduce
in interface Json<JsObj>
R
- the type of the reduction resultop
- the operator to apply to values of type Rmap
- the mapping function to convert JsPath and JsPrimitive to type Rpredicate
- the predicate that determines which values are included in the reductionOptional
describing the result of the reduction, or empty if no values satisfy the predicatepublic <R> Optional<R> reduce(BinaryOperator<R> op, Function<? super JsPrimitive,R> map, Predicate<? super JsPrimitive> predicate)
Json
reduce
in interface Json<JsObj>
R
- the type of the reduction resultop
- the operator to apply to values of type Rmap
- the mapping function to convert JsValue to type Rpredicate
- the predicate that determines which values are included in the reductionOptional
describing the result of the reduction, or empty if no values satisfy the predicatepublic JsObj delete(JsPath path)
Json
public int size()
Json
public Stream<JsPair> stream()
Json
JsPair
of elements in this JSON object.
This method provides a way to traverse and operate on the key-value pairs within the JSON object.public Stream<JsObjPair> streamOfKeys()
public boolean equals(JsObj that, JsArray.TYPE ARRAY_AS)
that
- The `JsObj` to compare with.ARRAY_AS
- Enum to specify how arrays are considered.public boolean containsKey(String key)
key
- The key to check for existence.public JsValue get(String key)
key
- The key to retrieve the JSON value for.public JsArray getArray(String key)
key
- the keypublic JsArray getArray(String key, Supplier<JsArray> orElse)
key
- the keyorElse
- the default valuepublic BigDecimal getBigDec(String key)
key
- the keypublic BigDecimal getBigDec(String key, Supplier<BigDecimal> orElse)
key
- the keyorElse
- the default valuepublic byte[] getBinary(String key)
key
- the keypublic byte[] getBinary(String key, Supplier<byte[]> orElse)
key
- the keyorElse
- the default valuepublic BigInteger getBigInt(String key)
key
- the keypublic BigInteger getBigInt(String key, Supplier<BigInteger> orElse)
key
- the keyorElse
- the default valuepublic Instant getInstant(String key)
key
- the keypublic Instant getInstant(String key, Supplier<Instant> orElse)
key
- the keyorElse
- the default valuepublic Boolean getBool(String key)
key
- the keypublic Boolean getBool(String key, Supplier<Boolean> orElse)
key
- the keyorElse
- the default valuepublic Double getDouble(String key)
BigDecimal.doubleValue()
and in some cases it can lose information about
the precision of the BigDecimalkey
- the keypublic Double getDouble(String key, Supplier<Double> orElse)
BigDecimal.doubleValue()
and in some cases it can lose information about
the precision of the BigDecimalkey
- the keyorElse
- the default valuepublic Integer getInt(String key)
key
- the keypublic Integer getInt(String key, Supplier<Integer> orElse)
key
- the keyorElse
- the default valuepublic Long getLong(String key)
key
- the keypublic Long getLong(String key, Supplier<Long> orElse)
key
- the keyorElse
- the default valuepublic JsObj getObj(String key)
key
- the keypublic JsObj getObj(String key, Supplier<JsObj> orElse)
key
- the keyorElse
- the default valuepublic String getStr(String key)
key
- the keypublic String getStr(String key, Supplier<String> orElse)
key
- the keyorElse
- the default valuepublic boolean isObj()
JsValue
public JsObj intersection(JsObj that, JsArray.TYPE ARRAY_AS)
Json
intersection
in interface Json<JsObj>
that
- the other JSON object to compute the intersection withARRAY_AS
- the array merging strategy, either 'MERGE' or 'REPLACE'public JsObj union(JsObj that, JsArray.TYPE ARRAY_AS)
Json
Copyright © 2023. All rights reserved.