Report a bug
		
				If you spot a problem with this page, click here to create a GitHub issue.
		
			Improve this page
		
			Quickly fork, edit online, and submit a pull request for this page.
			Requires a signed-in GitHub account. This works well for small changes.
			If you'd like to make larger changes you may want to consider using
			a local clone.
		
	asdf.jsonparser
JSON Parsing API
Authors: 
Ilya Yaroshenko
License: 
MIT
- AsdfparseJson(Flag!"includingNewLine" includingNewLine = Yes.includingNewLine, Flag!"spaces" spaces = Yes.spaces, Chunks)(Chunkschunks, size_tinitLength= 32)
 if (is(ElementType!Chunks : const(ubyte)[]));
- Parses json valueParameters:Chunks chunksinput range composed of elements type of const(ubyte)[]. chunkscan use the same buffer for each chunk.size_t initLengthinitial output buffer length. Minimum value is 32. Returns:ASDF valueExamples:import std.range: chunks; auto text = cast(const ubyte[])`true `; auto ch = text.chunks(3); assert(ch.parseJson(32).data == [1]); 
- AsdfparseJson(Flag!"includingNewLine" includingNewLine = Yes.includingNewLine, Flag!"spaces" spaces = Yes.spaces, Flag!"assumeValid" assumeValid = No.assumeValid, Allocator)(in char[]str, auto ref Allocatorallocator);
 AsdfparseJson(Flag!"includingNewLine" includingNewLine = Yes.includingNewLine, Flag!"spaces" spaces = Yes.spaces, Flag!"assumeValid" assumeValid = No.assumeValid)(in char[]str);
- Parses json valueParameters:char[] strinput string Allocator allocator(optional) memory allocator Returns:ASDF valueExamples:import std.experimental.allocator.mallocator: Mallocator; import std.experimental.allocator.showcase: StackFront; StackFront!(1024, Mallocator) allocator; auto json = parseJson(`{"ak": {"sub": "subval"} }`, allocator); assert(json["ak", "sub"] == "subval"); Examples:Faulty locationimport asdf; try { auto data = `[1, 2, ]`.parseJson; } catch(AsdfSerdeException e) { import std.conv; /// zero based index assert(e.location == 7); return; } assert(0); Examples:assert(`{"ak": {"sub": "subval"} }`.parseJson["ak", "sub"] == "subval"); 
- autoparseJsonByLine(Flag!"spaces" spaces = Yes.spaces, Flag!"throwOnInvalidLines" throwOnInvalidLines = No.throwOnInvalidLines, Input)(Inputinput);
- Parses JSON value in each line from a Range of buffers.Parameters:spaces adds support for spaces beetwen json tokens. Default value is Yes. throwOnInvalidLines throws an SerdeException on invalid lines if Yes and ignore invalid lines if No. Default value is No. Input inputinput range composed of elements type of const(ubyte)[] or string / const(char)[]. chunks can use the same buffer for each chunk. Returns:Input range composed of ASDF values. Each value uses the same internal buffer.
- autojsonParser(bool includingNewLine, bool hasSpaces, bool assumeValid, Allocator, Input = const(ubyte)[])(auto ref Allocatorallocator, Inputinput);
- structJsonParser(bool includingNewLine, bool hasSpaces, bool assumeValid, Allocator, Input = const(ubyte)[]);
Copyright © 2016-2022 by Ilya Yaroshenko | Page generated by
Ddoc on Thu Mar 24 03:41:36 2022