public final class Json extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Json.JsonValueModule
Jackson Module that uses a mixin to make sure that a
JsonValue instance is
serialized using its #getObject() value only. |
static class |
Json.LocalizableStringModule
Jackson Module that adds a serializer for
LocalizableString. |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkJsonCompatibility(String trail,
Object value)
Verify that the given parameter object is of a JSON compatible type (recursively).
|
static com.fasterxml.jackson.databind.ObjectWriter |
makeLocalizingObjectWriter(com.fasterxml.jackson.databind.ObjectMapper mapper,
PreferredLocales locales)
Make an object writer that contains the provided locales for serialization of
LocalizableString
instances. |
static com.fasterxml.jackson.databind.ObjectWriter |
makeLocalizingObjectWriter(com.fasterxml.jackson.databind.ObjectMapper mapper,
Request request)
Make an object writer that contains the locales from the request for serialization of
LocalizableString
instances. |
static Object |
readJson(Reader reader)
Parses to json the provided reader.
|
static Object |
readJson(String rawData)
Parses to json the provided data.
|
static Object |
readJsonLenient(InputStream in)
This function it's only used to read our configuration files and allows
JSON files to contain non strict JSON such as comments or single quotes.
|
static Object |
readJsonLenient(Reader reader)
This function it's only used to read our configuration files and allows
JSON files to contain non strict JSON such as comments or single quotes.
|
static byte[] |
writeJson(Object objectToWrite)
Writes the JSON content of the object passed in parameter.
|
public static void checkJsonCompatibility(String trail, Object value)
trail - pointer to the verified objectvalue - object to verifypublic static Object readJson(String rawData) throws IOException
rawData - The data as a string to read and parse.Map<String, Object>, List<Object>, Number, Boolean
or null.IOException - If an exception occurs during parsing the data.readJson(Reader)public static Object readJson(Reader reader) throws IOException
reader - The data to parse.Map<String, Object>, List<Object>, Number, Boolean
or null.IOException - If an exception occurs during parsing the data.public static Object readJsonLenient(Reader reader) throws IOException
reader - The stream of data to parse.Map<String, Object>, List<Object>, Number, Boolean
or null.IOException - If an error occurs during reading/parsing the data.public static Object readJsonLenient(InputStream in) throws IOException
in - The input stream containing the json.Map<String, Object>, List<Object>, Number, Boolean
or null.IOException - If an error occurs during reading/parsing the data.public static byte[] writeJson(Object objectToWrite) throws IOException
objectToWrite - The object we want to serialize as JSON output. TheIOException - If an error occurs during writing/mapping content.public static com.fasterxml.jackson.databind.ObjectWriter makeLocalizingObjectWriter(com.fasterxml.jackson.databind.ObjectMapper mapper,
Request request)
throws MalformedHeaderException
LocalizableString
instances. The provided mapper will be used to create the writer so that serialization configuration is
not recreated.mapper - The ObjectMapper to obtain a writer from.request - The CHF request.ObjectWriter.MalformedHeaderException - If the Accept-Language header is malformed.public static com.fasterxml.jackson.databind.ObjectWriter makeLocalizingObjectWriter(com.fasterxml.jackson.databind.ObjectMapper mapper,
PreferredLocales locales)
LocalizableString
instances. The provided mapper will be used to create the writer so that serialization configuration is
not recreated.mapper - The ObjectMapper to obtain a writer from.locales - The PreferredLocales instance to use for localization, or null.ObjectWriter.Copyright © 2025 Open Identity Platform Community. All rights reserved.