Create JSON Output
    • 09 Oct 2024
    • 2 Minutes to read
    • Contributors
    • PDF

    Create JSON Output

    • PDF

    Article summary

    The JSON output type is designed to create an output of the JSON format. The output has two tabs: JSON and Template. Both tabs are designed to create, edit, and view any file in the JSON output format.

    Creating the JSON output is similar to the process of creating the XML output, but there are still slight differences on which you are going to focus during the current exercise. To get details of creating the XML output, see Create XML Output (Template and Node Settings) and Create XML Output (Patterns and Rearranges).

    Exercise

    Download and import the attached configuration called 07. Create JSON Output in Lasernet Developer 9. Afterward, navigate to the Forms section and open the Sample form.

    1. Start by opening a template based on which you can create the required structure of your JSON output. To this end, on the toolbar, click Open Template.

    2. In the Open Template dialog displayed, select the template, and then click Open.

    1. In the dialog box that appears, click No to decline, to enable default values for nodes.

    1. In the output, switch to the JSON tab.

    2. Right-click the object node, and then click Expand All in the context menu that appears.

    1. Proceed to add rearranges, first to the input and then to the output. For more details about the procedure of adding rearranges, as well as a list of nodes for which you are proposing to add rearranges, see Create XML Output (Patterns and Rearranges).

    1. You are now proposed to specify an appropriate format and a regional profile for the IssueDate node value in the output.

    1. Add a rearrange to the Salesbalance node in the input, and then add it to the PayableAmount node in the input. However, you shall not specify an appropriate format for the PayableAmount node value as, by default, the node type is set to Number.

    2. Add a JobInfo to the CurrencyCode node in the input, and then add its value to the CurrencyCode node in the output. For more details about adding a JobInfo as well as its value, see Create XML Output (Patterns and Rearranges).

    1. Afterward, add a pattern to the Body_CustInvoiceTrans node in the output, and then add rearranges to this pattern.

    Unlike the XML output, when adding a multi-line pattern to the JSON output, you shall add it to an element of an array. It is so, because the JSON format does not allow having two or more nodes with the same name on the same level of hierarchy. It means that if you are going to use a multi-line pattern, you must create an array in your JSON output structure.

    1. Once you are done, add rearranges belonging to the pattern to the output, as well as add a JobInfo value to the CurrencyID node in the output.

    As the final step, you are proposed to modify the rest of the nodes in the output for which no rearranges are added so that they can take their default values. Here is the final view of your document after all the proposed alterations.

    07.-Create-JSON-Output
    98.67 KB


    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.