Creating Dynamic JSON with Python

  json, python, python-3.x

I’m starting with python and i"m struggling with a JSON creation with python

The suggested format it

"store": {
    "A": {
      "distance" : {
        "AB" : 4.71
      },
      "products" : {
        "A" : 3.21
      }
      "name" : "Test A"
    },
   "B": {
      "distance" : {
        "BA" : 4.71
      },
      "products" : {
        "A" : 3.21
      }
      "name" : "Test B"
    }
}

This code should be created dynamically in which I can have X numbers of store nodes, Y numbers of distances, and Z numbers of products

I tried in many ways but I had no success 🙁

Source: Python-3x Questions

LEAVE A COMMENT