libmir/asdf

asdf has compatible JSONValue?

zoujiaqing opened this issue · 8 comments

#include "simdjson.h"

int main(void) {
  simdjson::dom::parser parser;
  simdjson::dom::element tweets = parser.load("twitter.json");
  std::cout << tweets["search_metadata"]["count"] << " results." << std::endl;
}

So asdf code:

tweets["search_metadata", "count"];

JSONValue code:

tweets["search_metadata"]["count"].get!uint;
9il commented

Could you please clarify what means compatible?

9il commented

ASDF doesn't use Phobos JSONValue.

I meanns use more common ways of using..

9il commented

Like this one?

import std.conv: to;
auto integer = tweets["search_metadata", "count"].to!int;

Like this one:

tweets["search_metadata"]["count"];
9il commented

Maybe Asdf type is what you are looking for.

9il commented

If you are asking about if Asdf is compatible with JSONValue. No, it isn't.

9il commented

Asdf can now be de/serialized to/from mir.algebraic types.

https://forum.dlang.org/thread/itdobhbjiynjtijschoe@forum.dlang.org