Targeted JSON Pointer: for Array, push_back String


using Targeted JSON Pointer..

ASTER::ACTION::JSON::Targeted JSON Pointer: Is Array, Push_back with a String Data

Adding an element to the end of a JSON array and inserting string data.

  • Please complete target path setting in advance.

  • Ensure that the target data type is an array type.

If the Push_back command is executed successfully, the number of array elements will increase by 1.


Parameter

As a sample parameter for adding string data to an array, the following.

"ClickteamFusion25"

About Control Characters

CF25 has a specification that implicitly escapes string data sent via the expression editor.

"改行\r\n日本語\s\t"

The above string is a typical example where CF25’s implicit escape processing is executed.

The intended newline designation, which was meant to be "\r\n", is processed by CF25 with escape processing and becomes "\\r\\n".

The data received by ASTER and saved in the JSON string ultimately becomes "改行\\r\\n日本語\\s\\t".


Line Break Specification

By using NewLine$, the unique line break processing of CF25, the received data is not subject to escape processing.

In other words, control characters can be partially sent from the expression editor of CF25, but it is based on using the Proprietary specifications of CF25.

"TEST" + NewLine$ + "ABC"

In the above example, the data received by ASTER will be "TEST\r\nABC".

However, according to the specifications of JSON strings, control characters must be serialized to be stored in a JSON string. When saved as a JSON string, newline codes are transformed into "\\r\\n" through another internal escape processing.


JSON String Specifications

According to the JSON string specification, the string "\r\n" does not require escaping.

JSON strings require escape processing for \s\t.

Strings that require escape processing have different specifications between JSON and CF25, resulting in somewhat complex string transmission circumstances.

The specifications and limitations of CF25 lack complete compatibility with JSON data.

It is recommended that the creator checks the data specifications of the JSON string in advance, and after data transmission via ASTER, dumps the JSON and examines the saved data content.


Saving Directory Paths in JSON Strings

When saving directory paths in JSON strings

If you send a path like "c:\test" from CF25 to ASTER and save it in a JSON string, it will become "c:\\test".

Passing this string c:\\test to Windows Explorer results in an error.

However, when used in an internet browser, there are no errors, and the directory can be accessed. In Windows OS, if you enter ii "c:\\test" in PowerShell, no errors occur either.

This error is due to the particularity of Windows Explorer. One way to avoid this error is to send the string "c:/test" from CF25 to ASTER. This way, CF25’s implicit escape processing does not occur, and it can be saved as is in the JSON string.

Additionally, there will be no error when passing this string to Explorer.

By using regular expressions, it is easy to replace "c:\\test" with "c:\test" or "c:/test", so please use regular expressions to solve this.


Relevant URL

ASTER’s REGEX-related properties have control character options to reconvert data implicitly escaped by CF25.

However, this feature is not intended for use with JSON strings. When saving data to a JSON string, always ensure that the setting is turned off.