JSON Improvements

1C Developer team

14.04.2023 5 min


An increasing number of web services are moving to JSON messaging. To facilitate the work of application developers, we have decided to make the process of handling JSON as simple and convenient as possible.

Currently, there are 4 global context methods to read and write JSON: WriteJSON, WriteJSONDate, ReadJSON, ReadJSONDate. These methods offer extremely rich functionality and, as we see, it is redundant for most tasks of application developers. Still, the above methods are not available in web clients, while many integration tasks are handled through them.

In version 8.3.23, we added two new methods to the global context: WriteJSONValue and ReadJSONValue. The functionality of the new methods is "lighter" than the existing ones and should be sufficient for most integration tasks. While old methods ReadJSON and WriteJSON have to operate through objects ReadJSON and WriteJSON, our new methods offer much simpler syntax:

  • WriteJSONValue (<Value>) returns a string.

  • ReadJSONValue (<String>) returns Structure, Array, Number, String, Boolean, Undefined.

Both methods are available everywhere: thin client, web client, mobile client, server, thick client, external connection, mobile application (client), mobile application (server), and standalone mobile server. We do not deprecate the previous 4 methods, but we recommend using the new ones wherever possible. This, among other things, should make it possible to write versatile code that can run on all system components.

Here is an example. Assume we need to serialize a form's structure into a JSON string and then pass it to a web service:

       "LastName" "Johnson",
       "Name" "Peter"
       "MiddleName" "Matthew",
       "Phones": [

In the previous version, the code looks like this: 


Function GetJSONAtServer()

     Structure= NewStructure;

     Structure.Insert("LastName", "Johnson");

     Structure.Insert("Name", "Peter");

     Structure.Insert ("MiddleName", "Matthew");

     Phones = New Array;




     // getting JSON string

     WriteJSON = New WriteJSON;



     Return WriteJSON.Close();


With the new functions utilized, the code can also run on a web client, and the procedure for getting JSON strings is shorter. Here you need just a single line instead of four:


Function WriteValueJSON Client ()


     Structure.Insert("LastName", "Johnson");

     Structure.Insert("Name", "Peter");

     Structure.Insert("MiddleName", "Matthew");

     Phones= New Array;




     // getting JSON string

     Return WriteJSONValue(Structure);


We expect new methods will facilitate the handling of many real-life integration tasks.

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.