See: Description
Class | Description |
---|---|
Examples |
Created by tim on 09/01/15.
|
JsonObject
class represents JSON objects.
A JSON object is basically just a map which has string keys and values can be of one of the JSON supported types
(string, number, boolean).
JSON objects also support null values.
==== Creating JSON objects
Empty JSON objects can be created with the default constructor.
You can create a JSON object from a string JSON representation as follows:
[source,java]
----
Examples.example0_1()
----
==== Putting entries into a JSON object
Use the JsonObject.put(java.lang.String, java.lang.Enum)
methods to put values into the JSON object.
The method invocations can be chained because of the fluent API:
[source,java]
----
Examples.example1()
----
==== Getting values from a JSON object
You get values from a JSON object using the getXXX
methods, for example:
[source,java]
----
Examples.example2(io.vertx.core.json.JsonObject)
----
==== Encoding the JSON object to a String
You use JsonObject.encode()
to encode the object to a String form.
=== JSON arrays
The JsonArray
class represents JSON arrays.
A JSON array is a sequence of values (string, number, boolean).
JSON arrays can also contain null values.
==== Creating JSON arrays
Empty JSON arrays can be created with the default constructor.
You can create a JSON array from a string JSON representation as follows:
[source,java]
----
Examples.example0_2()
----
==== Adding entries into a JSON array
You add entries to a JSON array using the JsonArray.add(java.lang.Enum)
methods.
[source,java]
----
Examples.example3()
----
==== Getting values from a JSON array
You get values from a JSON array using the getXXX
methods, for example:
[source,java]
----
Examples.example4(io.vertx.core.json.JsonArray)
----
==== Encoding the JSON array to a String
You use JsonArray.encode()
to encode the array to a String form.Copyright © 2015. All Rights Reserved.