Open In App

Microsoft Azure – Using JSON with Azure Logic Apps

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

In this article, we will look into how to create JSON Schema that can be used in Azure logic apps. For the sake of example, here one of our goals is to create an Azure logic app that gets triggered by an HTTP request. 

Now, when we pass our JSON payload over, we want it to be validated. So, let’s look into a few tools that we could use to generate some sample JSON data, as well as to create a JSON Schema based on it. 

First, let’s look at ObjGen. This is an online tool that we could use to just mark out some sample JSON data. So, notice we could come here and we could just start typing in some properties and giving it values, and on the right side, it will just generate some information for us.we

Now, we could copy our JSON data and we can go over to another tool called the JSON Schema tool. What we could do here now, is paste in that JSON data, and hit “Submit”. 

Notice here on the right side, it’s going to create that JSON Schema that we could use as shown below:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "The root schema comprises the entire JSON document.",
    "default": {},
    "examples": [
        {
            "CompanyName": "Geeksforgeeks",
            "CompanyOwner": "Sandeep Jain"
        }
    ],
    "required": [
        "CompanyName",
        "CompanyOwner"
    ],
    "properties": {
        "CompanyName": {
            "$id": "#/properties/CompanyName",
            "type": "string",
            "title": "The CompanyName schema",
            "description": "An explanation about the purpose of this instance.",
            "default": "",
            "examples": [
                "Geeksforgeeks"
            ]
        },
        "CompanyOwner": {
            "$id": "#/properties/CompanyOwner",
            "type": "string",
            "title": "The CompanyOwner schema",
            "description": "An explanation about the purpose of this instance.",
            "default": "",
            "examples": [
                "Sandeep Jain"
            ]
        }
    },
    "additionalProperties": true
}

Now, we could use this JSON Schema inside of the HTTP action inside of the Azure logic app to help validate that JSON, that might come over in the body.


Last Updated : 03 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads