Package org.infinispan.protostream.impl
Class JsonUtils
java.lang.Object
org.infinispan.protostream.impl.JsonUtils
Utility class for conversion to and from canonical JSON.
- Since:
- 4.4
- Author:
- [email protected]
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
fromCanonicalJSON
(ImmutableSerializationContext ctx, Reader reader) static String
toCanonicalJSON
(ImmutableSerializationContext ctx, byte[] bytes, boolean prettyPrint) Converts a Protobuf encoded message to its canonical JSON representation.
-
Method Details
-
fromCanonicalJSON
public static byte[] fromCanonicalJSON(ImmutableSerializationContext ctx, Reader reader) throws IOException - Throws:
IOException
-
toCanonicalJSON
public static String toCanonicalJSON(ImmutableSerializationContext ctx, byte[] bytes, boolean prettyPrint) throws IOException Converts a Protobuf encoded message to its canonical JSON representation.- Parameters:
ctx
- the serialization contextbytes
- the Protobuf encoded message bytes to parseprettyPrint
- indicates if the JSON output should use a 'pretty' human-readable format or a compact format- Returns:
- the JSON string representation
- Throws:
IOException
- if I/O operations fail
-