[][src]Module conjure_serde::json

JSON serialization support.

Conjure specifies behavior that differs from serde_json's in a couple of ways:

  • serde_json serializes non-finite floating point values as null, while Conjure specifies "Infinity", "-Infinity", and "NaN" as appropriate.
  • serde_json serializes byte sequences as arrays of numbers, while Conjure specifies Base64-encoded strings.

Additionally, Conjure clients should ignore unknown fields while Conjure servers should trigger errors.

This crate provides Serializer and Deserializer implementations which wrap serde_json's and handle these special behaviors.

Structs

ClientDeserializer

A serde JSON deserializer appropriate for use by Conjure clients.

Serializer

A serde JSON serializer compatible with the Conjure specification.

ServerDeserializer

A serde JSON deserializer appropriate for use by Conjure servers.

Functions

client_from_reader

Deserializes a value from a reader of JSON data.

client_from_slice

Deserializes a value from a slice of JSON data.

client_from_str

Deserializes a value from a string of JSON data.

server_from_reader

Deserializes a value from a reader of JSON data.

server_from_slice

Deserializes a value from a slice of JSON data.

server_from_str

Deserializes a value from a string of JSON data.

to_string

Serializes a value as JSON into a string.

to_vec

Serializes a value as JSON into a byte buffer.

to_writer

Serializes a value as JSON into a writer.