:thread: query from json file
# help
p
๐Ÿงต query from json file
Is it possible to send a json response by quering from a json file?
example I have a json file containing
Copy code
{
  "items": [
    {
      "id": 1,
      "name": "Item 1",
      "description": "Description of Item 1"
    },
    {
      "id": 2,
      "name": "Item 2",
      "description": "Description of Item 2"
    },
    {
      "id": 3,
      "name": "Item 3",
      "description": "Description of Item 3"
    }
  ]
}
now based on my request, I want to return response based on
id
in the json document above
Or do we need to have seperate json file for reach of the item in the json list above
l
I don't believe there is a way to read the data from a file. You could parse your data using
parseJson
at the top of your response and then query that json to determine what response to send back. This doesn't work very well if you want to share that data across multiple stubs though
๐Ÿ‘ 1