Documentation
AcademyCommunitySign In
  • 👋Overview
  • 💙Platform Features
  • Getting started
    • 🚪Signing up & Logging in
      • 👤Profile Settings
    • 🎛️App Management
    • ✴️Templates to Start With
      • Basic Template (Blank app)
      • CRM Template
    • 👨‍🎓Learning Directual
      • 👨‍🏫Webinars
  • Data base
    • Data Structures
      • System Structures
    • Data Types
      • Markdown Cheat Sheet
      • Indexing Fields
      • Formatting Date/Time
    • Directual Query Language (DQL)
    • Import and Export
      • Import API
    • File Storage
      • API for File Storage
  • API and integraions
    • API-Endpoints
      • Advanced techniques for GET and POST requesting
        • Paging for GET-requests
        • Dynamic sorting for GET-requests
        • Custom filtering parameters for GET-requests
        • Advanced filtering for GET-requests
        • Formatting response for GET-request
        • Fields validation for POST-requests
        • Synchronic scenarios for POST-requests
        • Cross-Origin Resource Sharing CORS
      • API testing and debugging
      • Coding mode (raw mode) in filters
      • Swagger specification
    • Webhooks
    • Authentication API
      • Login/password
      • OpenID connect
      • Facebook oAuth
      • Google oAuth
    • Security Features
    • Other Integrations
      • OpenAI
      • Integration Hubs
        • Zapier
      • Telegram
        • Telegram: Advanced Techniques
      • Email
        • SMTP
        • Gmail
      • Twilio SMS
      • Airtable
      • Coupler.io
      • Other No-Code Tools
        • Bubble.io
          • Authorization
          • Displaying Data from Directual on Bubble
        • Adalo
        • UI bakery
        • Tilda
        • AppGyver
  • App interface
    • Web-App Builder basics
    • Web-App Settings
      • General web-app settings
      • Main menu
      • Creating a logotype
      • Web-App color scheme
      • Web-app typography
      • White Labeling
      • Web-App Icon
      • Custom Domain
      • Custom code
    • Setting Up Page Layout
      • Subpages and URL Parameters
    • Components
      • Multistep Form
      • Cards
      • Table
      • Kanban
      • Chart
      • Markdown text
      • HTML code
      • Hint
      • Link Button
      • Video
      • Form (outdated)
    • Embedding Pages
  • Scenarios
    • Understanding Directual Scenarios
      • Directual Event Model
    • Event-Based Triggers
    • Scheduled Triggers
      • Cron Format
    • Synchronous Scenarios
    • Editing Scenarios
      • System Steps
        • Start step
        • Delay step
        • Comment step
        • Catch error step
        • Link scenario step
        • Exit step
      • Action steps
        • Edit object step
        • Create object step
        • Search objects step
        • JSON step
        • Delete object step
        • Run report step
        • Generate document step
        • JS SDK step
      • Condition steps
        • Condition step
        • A/B test step
        • JS SDK condition step
      • Integration steps
        • HTTP-request step
        • Zapier step
        • Telegram step
        • API response
        • Email step
        • SQL-request step
        • Queue step
    • Using Variables
      • Global Variables
      • Context Variables (scenario parameters)
    • Testing and Debugging
    • System Scenarios
    • Advanced Scenario Settings
  • Template system
    • Templating Principles
      • Templating Techniques for Scenarios
      • Templating Techniques for Web-pages
    • Coding Mode (evaluating as a JS-expression)
    • Comparison Component
      • Regular Expressions
    • Tips for Dealing with Data
  • Telegram
    • Telegram
  • Plugins
    • 🔌Using Plugins
      • Scenario Steps Plugins
      • Web Plugins
      • User Authentication Plugins (Not Web3)
        • TMA (Telegram Mini App)
        • Google OAuth Plugin
        • Facebook OAuth Plugin
        • Open ID Auth Plugin
      • Blockchain (Web3)
        • TON (The Open Network)
        • Polygon
        • Ethereum
        • NEAR Protocol
        • NFT and Smart-Contracts
        • MetaMask Wallet
        • WalletConnect
      • WebSockets (Socket.IO)
    • 🪚Developing Plugins
      • Developing Scenario Plugins
      • Developing Web-plugins
        • Example: Using Chart.js in Directual
        • Example: Building Simple Form
        • Example: TON plugin
  • Teams
    • Teams
    • Sandbox Apps
  • JavaScript SDK
    • Directual + JavaScript SDK: The Basics
    • Internal $D Methods
    • Using Google Sheets
    • JS SDK: Examples
  • Reports
    • Reports
  • App life cycle management
    • App Versions
  • Directual 💙 React JS
    • Directual + React JS
  • Pricing and billing
    • 💳How Billing Works
    • 🎁Promo Codes
    • Pricing Plans for Apps
    • Team Pricing Plans
    • How we count requests and operations
    • On-Demand Resource Consumption
    • 🤝Affiliate Program
  • Hire a Directual expert
    • 🏆Certification
    • 🤝Matching with Experts
    • 🏦Escrow service
  • Security and stability
    • 🛡️Public Cloud
    • Platform Architecture
  • Support
    • 📬Contact Directual
  • Directual step-by-step
    • Public Development Roadmap
      • Step 0: Planning App Architecture
      • Step 1: Requesting Features
      • Step 2: Approving Features
      • Step 3. Upvoting Features
      • Step 4. Watching Features
    • Weather Forecast App
    • Web3 Marketplace on Polygon
    • Transferring NFT
Powered by GitBook
On this page
  • Setting up JSON schema
  • Parsing JSON to fields and objects
  • Parsing nested objects
  • Parsing complex arrays
  • Composing JSON from fields and objects
  • Composing nested objects
  • Composing complex arrays

Was this helpful?

  1. Scenarios
  2. Editing Scenarios
  3. Action steps

JSON step

PreviousSearch objects stepNextDelete object step

Last updated 2 years ago

Was this helpful?

This step is available at Startup, Pro and Business

The example of data in JSON format:

{
  "firstName": "Ernest",
  "lastName": "Hemingway",
  "isGenius": "true",
  "books": [
    {
      "name": "The Sun Also Rises",
      "year": "1927"
    },
    {
      "name": "The Old Man and the Sea",
      "year": "1951"
    }
  ]
}

This step is made for:

  • vice versa—composing JSON data from objects (usually, in order to send this piece of data to a third party system).

Setting up JSON schema

First and foremost, you need to setup JSON schema for parsing or composing. You can do it simply by copy-pasting example of your JSON-data into the field (the values may be any, only keys are matter).

The component will validate your JSON automatically—you won't be able to proceed in case of an error in scheme.

After setting up the scheme you can choose what are you going to do: to parse or to compose JSON.

Parsing JSON to fields and objects

Parsing nested objects

If the property is object, you will have two options for parsing.

// example of object property – "book":
{
   "book": {
      "title": "Crime and Pinishment",
      "author": "Dostoevsky"
   }
}

Parsing nested objects. Option 1. Parsing to current object

You can fetch properties of object without creating new objects on Directual. Choose to current object in a subselect.

Parsing nested objects. Option 2. Parsing to a new object

You can map properties of object to the fields of a new object on Directual. Choose to other object in a subselect. On the right side you choose field type of link, a new object will be created (or of you map property to id field and such an object exists, it will be edited accordingly).

Parsing complex arrays

If the property is a complex array (an array of objects), you will have two options for parsing.

// example of complex array property – "books":
{
  "books": [
    {
      "name": "The Sun Also Rises",
      "year": "1927"
    },
    {
      "name": "The Old Man and the Sea",
      "year": "1951"
    }
  ]
}

Simple arrays (like ["1","2","3"]) can be parsed to string or array fields directly.

Parsing arrays of objects. Option 1. Parsing array to objects

If you choose to parse array property to objects, you will have to choose the destination field type of arrayLink. The step will create new objects and write array of IDs of these objects into the selected field.

In this option you configure mapping of child elements of the JSON array to child elements of arrayLink field.

Parsing arrays of objects. Option 2.1 Saving one element from the array as a separate JSON

You can pick one element from the JSON array and save it to a field type of JSON.

Parsing arrays of objects. Option 2.2 Saving one element from an array as a new object

You can pick one element from the JSON array and save it to a new object. In order to do that choose field type of link on the right side. The step will create new object and write ID of this object into the selected field.

Note, that you can combine any type of parsing.

Composing JSON from fields and objects

Note that here (only here) you can choose the fields of linked (like {{authorId.firstName}}) objects and paste them to the composed JSON:

Composing nested objects

If the field (on the left side) has a type of link, the json property will be nested object& You setup mapping of fields of the elements from linked object and properties of nested object property (which were set up in JSON Schema).

// example of object property to compose from linked object – "book":
{
   "book": {
      "title": "Crime and Pinishment",
      "author": "Dostoevsky"
   }
}

Composing complex arrays

If the field (on the left side) has a type of arrayLink, the json property will be array as well, with elements from this field. You setup mapping of fields of the elements from arrayLink and properties of array (which were set up in JSON Schema).

// example of complex array property to be composed – "books":
{
  "books": [
    {
      "name": "The Sun Also Rises",
      "year": "1927"
    },
    {
      "name": "The Old Man and the Sea",
      "year": "1951"
    }
  ]
}

JSON () is a lightweight data format. JSON is the most popular data-interchange language—90% of all the APIs on the Internet interchange data in JSON format.

parsing JSON-data to (in order to process them);

You can also use to handle JSON data

First, you choose the field in object () where the step will get the JSON to parse.Then, you map json properties to the fields of the current object.

First, you choose the field in object () in which the composed JSON will be saved.Then, you map fields of the current object and json properties.

JavaScript Object Notation
objects
JavaScript SDK
type of json
type of json
pricing plans