The OpenD Programming Language

serializeJsonPretty

JSON serialization function with pretty formatting and custom output range.

  1. void serializeJsonPretty(Appender appender, V value, int serdeTarget)
    template serializeJsonPretty(string sep = "\t")
    void
    serializeJsonPretty
    (
    Appender
    V
    )
    (
    scope ref Appender appender
    ,
    scope auto ref V value
    ,
    int serdeTarget = SerdeTarget.json
    )
    if (
    isOutputRange!(Appender, const(char)[]) &&
    isOutputRange!(Appender, char)
    )
  2. string serializeJsonPretty(V value, int serdeTarget)

Members

Functions

serializeJsonPretty
void serializeJsonPretty(Appender appender, V value, int serdeTarget)
serializeJsonPretty
string serializeJsonPretty(V value, int serdeTarget)

JSON serialization function with pretty formatting.

Examples

static struct S { int a; }
assert(S(4).serializeJsonPretty!"    " == "{\n    \"a\": 4\n}");
import mir.format: stringBuf;
auto buffer = stringBuf;
static struct S { int a; }
serializeJsonPretty!"    "(buffer, S(4));
assert(buffer.data == "{\n    \"a\": 4\n}");

Meta