NOTE: This page has been translated automatically from Russian to English. Original page.



1С:JSON

JSON parser and serializer c full support for standard, a wide range of advanced serialized types and the parser.

Features

The parser and serializer supports two modes (format) works:

  • Standard - Full support for standard JSON;
  • Alternative - directed to the use in the projects imply a constant two-way communication and require enhanced parsing speed, minimizing the transport packets and unambiguous identification of the access types in the incoming data.

Regardless of the operating mode of the serializer, on demand, automatically transfer not only a unique reference identifier, but also its performance, and the parser in turn, analyzing the input data presentation omits references, not including them in the result set.


If necessary, the serializer may mask the Cyrillic alphabet symbols of modern Slavic languages ​​"ABVGҐDЂЃEf4; ЁЄZhZЅIg7; ІЇYЈKLЉMNЊOPRSTЋЌUЎFHTSCHЏSHSCHYEYUYA".


It supports all of the runtime restricted serializable types. It uses a cross-platform code.

Alternate mode

  • Not supported format, both in inbound and outbound data;
  • Serialization of reference types in a string representation of a service.


amenities

parser

  • Resistance to incorrect data or exposure to injection attacks;
  • Advanced parser (indicates the location and the type of error in the data);
  • Support the format of the incoming data (standard mode only);
  • Safe parsing format - unmasked formatting characters in the string value will not be lost;
  • Support lines in single and double quotes;
  • Automatic reduction of the object to the structure or compliance depending on the properties of names;
  • Automatic conversion to type a string date type "9999-99-99T99: 99: 99Z";
  • Automatic conversion to the type of species UnikalnyyIdentifikator line "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
  • Automatic detection mode (standard or alternate) of incoming data;
  • Detect the required cut-off submission of links;
  • Unique identification of links (only alternative mode).

serializer

  • Support the format of outgoing data (standard mode only);
  • Wide serialized data structure types including links;
  • Automatic reduction of the values ​​of the corresponding key to the string representation 1C;
  • Automatically convert unsupported types to the line;
  • Insensitive to localization.


trouble

  • Non-standard formatted code (Alt + Shift + F to help) on the verge of readability;
  • The serializer is focused on medium-large data packages.


serializable types

  • Undefined;
  • Null;
  • Primitive types   (all);
  • Universal collections of values   (all);
  • Unique identificator;
  • LyubayaSsylka;
  • Inquiry;
  • RezultatZaprosa;
  • VyborkaIzRezultataZaprosa;
  • PostroitelZaprosa;
  • PostroitelOtcheta;
  • DannyeFormyKollektsiya   (only 8.2);
  • DannyeFormyStrukturaSKollektsiey   (only 8.2);
  • DannyeFormyDerevo   (only 8.2)
  • DvoichnyeDannye;
  • Picture;
  • HranilischeZnacheniya.


The order of serialization types
 

  • Undefined - serialized as Null;
  • Null - according to the standard;
  • Primitive types - according to the standard;
  • Arrays and COMSafeArray - array, according to the standard:

[Value ...]

  • Structures and compliance - the object, according to the standard;

{Key: value, ...}

  • SpisokZnacheny - an array of objects from the three properties "value", "Presentation" and "Mark";

[{ "Value": This is the "Presentation": Presentation, "Mark": Marking} ...]

  • KlyuchIZnachenie - an object with two properties "Key" and "Value";

{ "Key": Key "value": value}

  • TablitsaZnacheny - an array of objects:

[{Column: Value, ...}, ...]

  • DerevoZnacheny - an array of objects with the obligatory "Rows" property:

[{Column: value ..., "Strings": [{column: value ..., "Strings": [...]}, ...]} ...]

  • UnikalnyyIdentifikator - leading to a string of the form "xxxxxxxx-xxxx-xxxx-xxxx -xxxxxxxxxxxx";
  • LyubayaSsylka:
    • - Standard mode - receiving a unique identifier links and serialization;
    • - Alternative treatment - leading to the official line of the form "|ref| ... |".

When serializing link mode automatically transfer not only serialized reference value, but also its performance. Each link is transmitted as an object with two properties, "Link" and "Presentation".

{ "Link": The link "View": Presentation}

  • Query - automatically and is serialized as a table of values;
  • RezultatZaprosa - serialized as a table of values;
  • VyborkaIzRezultataZaprosa - serialized as the structure of the values ​​of the current record of the query result;
  • PostroitelZaprosa - automatically and is serialized as a table of values;
  • PostroitelOtcheta - automatically and is serialized as a table of values;
  • DannyeFormyKollektsiya - serialized as a table of values;
  • DannyeFormyStrukturaSKollektsiey - serialized as a table of values;
  • DannyeFormyDerevo - serialized as the values ​​of the tree;
  • DvoichnyeDannye - encoded via base64 and serialized as a string;
  • Picture - and automatically converted serialized as binary data;
  • HranilischeZnacheniya - automatically extracted and stored value is serialized according to the type of the extracted value.


Recommendation

When working with projects in the outgoing string data which is not guaranteed the absence of symbols of the ranges:

  • [0x007f, 0x009f], 0x00ad, [0x0600, 0x0604], 0x070f, [0x17b4, 0x17b5],
  • [0x200c, 0x200f], [0x2028, 0x202f] [0x2060, 0x206f], 0xfeff, [0xfff0, 0xffff]

it is recommended not to disable the setting complete masking symbols.

Performance

Performance parser exclusively depends on the set of input data and formatting the availability. The worst option is a rich array of numbers, the best - plain array of strings.

Intel Core 2 Duo   T5870   @ 2GHz - rich array of all approximately uniformly occurring types of data:

Parser: 35 KB / s.

Serializer: 165 kB / s.


History

  • Version 2.0.0.17:
    • - (New) Masking characters Cyrillic alphabets of modern Slavic languages (on demand);
    • - (New) Support serializer types DvoichnyeDannye, Picture, HranilischeZnacheniya;
    • - (Change) Refactoring variables and procedures;
    • - (Fix) Serialization type COMSafeArray;
    • - (Fix) Removed unnecessary keywords "Export".
    • - (Optimization) Decrease in checks relating to the mode and parameters parsing and serializtsaii;
    • - (Optimization) Checking formatting needs analysis factored out of the analysis procedure of formatting;
    • - (Optimization) The algorithm automatically bring the object to the structure or compliance depending on the properties of names;
    • - (Optimization) Refusal of an explicit cast in favor implicit in the terms of the operators;
    • - (Optimization) The refusal of the operator "Trying exception" when converting to a string unique identifier;
    • - (Optimization) The procedure for type checking when parsing.
  • Version 2.0.0.15:
    • - Release.
Project Resource , all successful programming :)

1C:Enterprise Developer's Community