IP*Works! 2016 .NET Edition
IP*Works! 2016 .NET Edition
Questions / Feedback?

JSON Configuration

The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

JSON Configuration Settings

CacheContent:   If true, the original JSON is stored internally in a buffer.

This config controls whether or not the component retains the entire original JSON data in a buffer. This is used to retain the original JSON as opposed to returning generated JSON after parsing. The default value is true.

Charset:   Specifies the charset used when encoding data.

Set this value to specify the charset that is used when encoding data. This setting also defines the encoding attribute in XMLDeclaration. The default value is "utf-8".

CloseInputStreamAfterProcess:   Determines whether or not the input stream is closed after processing.

Determines whether or not the input stream set by SetInputStream is closed after processing is complete. The default value is True.

CloseOutputStreamAfterProcess:   Determines whether or not the output stream is closed after processing.

Determines whether or not the output stream set by SetOutputStream is closed after processing is complete. The default value is True.

PrettyPrint:   Determines whether output is on one line or "pretty printed".

The value of this configuration setting determines whether output is generated as a single line of JSON or multiple, "pretty printed" lines. For a better understanding please take the example code below:

json.Config("PrettyPrint=true"); // false
json.StartObject();
json.PutName("data");
json.StartObject();
json.PutProperty("id", "3", 3);
json.PutProperty("first_name", "Emma", 2);
json.PutProperty("last_name", "Wong", 2);
json.PutProperty("avatar", "https://s3.amazonaws.com/uifaces/faces/twitter/olegpogodaev/128.jpg", 2);
json.EndObject();
json.EndObject();
json.Flush();
Console.WriteLine(json.OutputData);
With PrettyPrint set to False (the default) the output would be this:
{"data":{"id":3,"first_name":"Emma","last_name":"Wong","avatar":"https:\/\/s3.amazonaws.com\/uifaces\/faces\/twitter\/olegpogodaev\/128.jpg"}}
With PrettyPrint set to True the output would instead be this:
{
  "data": {
    "id": 3,
    "first_name": "Emma",
    "last_name": "Wong",
    "avatar": "https:\/\/s3.amazonaws.com\/uifaces\/faces\/twitter\/olegpogodaev\/128.jpg"
  }
}
The default value is False.
StringProcessingOptions:   Defines options to use when processing string values.

This setting determines what additional processing is performed on string values during parsing. By default no additional processing is performed and the string is returned as is from the document. Strings may also be unquoted, unescaped, or both. Possible values are:

0 (none - default)No additional processing is performed.
1 (unquote) Strings are unquoted.
2 (unescape) Any escaped sequences are unescaped.
3 (unquote and unescape) Values are both unquoted and unescaped.

For instance, given the JSON element:

"example" : "value\ntest"
The following table shows the resulting value for the XText of the element.

StringProcessingOptionOutput
0 (none)
"value\ntest"
1 (unquote)
value\ntest
2 (unescape)
"value
test"
3 (unquote and unescape)
value
test

XPathNotation:   Specifies the expected format when setting XPath.

This setting optionally specifies the expected input format when setting XPath. Possible values are:

  • 0 (Auto - default)
  • 1 (XPath)
  • 2 (JSONPath)
In most cases the default of 0 (Auto) is sufficient. The component will determine whether the path value is in XPath or JSONPath format automatically. If desired the type may be explicitly set to either XPath or JSONPath using the values above.

Base Configuration Settings

GUIAvailable:   Tells the component whether or not a message loop is available for processing events.

In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The component will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.

In some non-GUI applications an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GuiAvailable to false will ensure that the component does not attempt to process external events.

UseBackgroundThread:   Whether threads created by the component are background threads.

If set to True, when the component creates a thread the thread's IsBackground property will be explicitly set to True. By default this setting is False.

UseInternalSecurityAPI:   Tells the component whether or not to use the system security libraries or an internal implementation.

By default the component will use the system security libraries to perform cryptographic functions. When set to False calls to unmanaged code will be made. In certain environments this is not desirable. To use a completely managed security implementation set this setting to True. Setting this to True tells the component to use the internal implementation instead of using the system's security API.

Note: This setting is static. The value set is applicable to all components used in the application.

When this value is set the product's system DLL is no longer required as a reference, as all unmanaged code is stored in that file.

 
 
Copyright (c) 2020 /n software inc. - All rights reserved.
IP*Works! 2016 .NET Edition - Version 16.0 [Build 7353]