1
JSON Path validation against schema
Question asked by Steven Prescott - 2/19/2024 at 6:44 PM
Unanswered
Is there a way to create or validate a JSON path against my schema using liquid studio? 
I would love a option assistant to help me in developing the JSON path and options when I have a schema, but limited JSON documents. 

2 Replies

Reply to Thread
0
Liquid Support Replied
Employee Post
Hi,

JSON path is not currently supported like XPath, but it is something we can look at.

I'm not sure how you see the Schema working? You can already generate sample JSON documents from JSON Schema and visa-versa if that's what you require?
0
Steven Prescott Replied
I would like a JSON Path tool for a schema or/and JSON data file. If you have just a schema, it can help you build the JSON path by giving you the options as you drill down. For example schema below (from json-schema dot org), you would have initial options of "fruits" or "vegetables", if you have $.vegetables[*]. then veggieName and veggieLike would show up. This would allow you to validate your JSON Paths are correct, even if you don't have data files to match. 
Auto generating data files from the schema is nice though, I will have to use that. If you have a schema and a data file then it would provide you the results. This shouldn't be a fairly simple tool to add and would be helpful for my complex JSON models, when I want to build query's or do reference updates. 


{
  "description": "A representation of a person, company, organization, or place",
  "type": "object",
  "properties": {
    "fruits": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "vegetables": {
      "type": "array",
      "items": { "$ref": "#/$defs/veggie" }
    }
  },
  "$defs": {
    "veggie": {
      "type": "object",
      "required": [ "veggieName", "veggieLike" ],
      "properties": {
        "veggieName": {
          "type": "string",
          "description": "The name of the vegetable."
        },
        "veggieLike": {
          "type": "boolean",
          "description": "Do I like this vegetable?"
        }
      }
    }
  }
}

Reply to Thread