serialized 1.1.8

D XML/JSON serialization code generator based on boilerplate


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

serialized

Build Status License Dub Version

Serialized is a library that automates encoding and decoding of D data types to JSON and XML.

It heavily relies on boilerplate to extract information about struct/class type layouts; as such automatic encoding/decoding can only be used with types that have a boilerplate constructor.

This library forks from Funkwerk's internal Utilities library. Hence while it is extensively tested, it also contains a moderate amount of legacy code. The important packages for automatic encoding and decoding are text.xml/json.Encode/Decode.

Serialized uses dxml for XML encoding/decoding and stdx_data_json for JSON encoding/decoding.

Basic usage: XML

import text.xml.Xml;

@(Xml.Element("Root"))
struct Element
{
  @(Xml.Attribute("attribute"))
  string attribute;

  mixin(GenerateThis);
}

...

import text.xml.Decode;

const xmlText = `<Root attribute="Hello World"/>`;
const value = decode!Element(xmlText);

assert(value == Element("Hello World"));

Basic usage: JSON

import text.xml.Xml;

struct Element
{
  string attribute;

  mixin(GenerateThis);
}

...

import text.json.Decode;

const jsonText = `{ "attribute": "Hello World" }`;
const value = decode!Element(jsonText);

assert(value == Element("Hello World"));

License

This project is made available under the Boost Software License 1.0.

Authors:
  • Mathis Beer
Dependencies:
boilerplate, dxml, unit-threaded, dshould, sumtype, prettyprint
Versions:
1.1.8 2020-Oct-28
1.1.7 2020-Oct-01
1.1.6 2020-Sep-30
1.1.5 2020-Sep-29
1.1.4 2020-Sep-29
Show all 13 versions
Download Stats:
  • 1 downloads today

  • 1 downloads this week

  • 7 downloads this month

  • 33 downloads total

Score:
0.5
Short URL:
serialized.dub.pm