Articles on: Shopify

JSON file format

The JSON file format is quite simple. All you need is to identify the Data Key. The data key is the first object in your file.

For example, the JSON Data Key in this file is Products.

{
    "Products": [
        {
            "Features": [],
            "Id": 297,
            "Name": "Jeans",
            "Type": 1,
            "Variants": [
                {
                    "Barcode": "123456789",
                    "Color": "Classic Black",
                    "Discontinued": false,
                    "Id": "2123207144",
                    "Images": [
                        {
                            "Path": "https://images.adidasshoe.jpg",
                            "SkuId": "25347"
                        }
                    ],
                    "Price": 250.00,
                    "ShowInShop": true,
                    "Size": "S",
                    "Usage": ""
                }
            ]
        }
    ]
}


If the JSON file is in this structure, where there is a child object in your file.

{
  "objects": {
    "product": [
      {
        "Features": [],
        "Id": 297,
        "Name": "Jeans",
        "Type": 1,
        "Variants": [
          {
            "Barcode": "123456789",
            "Color": "Classic Black",
            "Discontinued": false,
            "Id": "2123207144",
            "Images": [
              {
                "Path": "https://images.adidasshoe.jpg",
                "SkuId": "25347"
              }
            ],
            "Price": 250.00,
            "ShowInShop": true,
            "Size": "S",
            "Usage": ""
          }
        ]
      }
    ]
  }
}


Another example, the Variant node for this JSON file will be Variants.

{
  "Products": [
    {
      "Features": [],
      "Id": 297,
      "Name": "Jeans",
      "Type": 1,
      "Variants": [
        {
          "Barcode": "123456789",
          "Color": "Classic Black",
          "Discontinued": false,
          "Id": "2123207144",
          "Images": [
            {
              "Path": "https://images.adidasshoe.jpg",
              "SkuId": "25347"
            }
          ],
          "Price": 250.00,
          "ShowInShop": true,
          "Size": "S",
          "Usage": ""
        }
      ]
    }
  ]
}



For instance, JSON allows using wildcard data names. You can use these products/* to include as a wildcard.

{
  "products": [
    {
      "prod1": Lipstick
    },
    {
      "prod2": "Jeans"
    },
    {
      "prod3": "Shirt"
    },
    {
      "prod4": "Pants"
    },
  ]
}



Another example, JSON can select a specific price from this format. To get the Australia price, can put the mapping as this meta_data/@key=_australia_price/value

"meta_data": [        
{            
    "id": 601768,            
    "key": "yith_wcgpf_product_feed_configuration",            
        "value": {                
                    "brand": "",               
                    "gtin": "",                
                    "mpn": "",               
                    "condition": "default",                                                                      
                    "google_product_category": "99999",               
                    "adult": "default",               
                 },       
                {
     "id": 601770,            
     "key": "_usa-1_price",            
     "value": "124.4751"        
},
{    
    "id": 601773,            
    "key": "_australia_price",        
    "value": "149.97"        
},        
{            
    "id": 601774,            
    "key": "_australia_regular_price",            
    "value": "249.95"        
},        
{            
    "id": 601775,            
    "key": "_australia_sale_price",            
    "value": "149.97"        
}

}
]

Updated on: 29/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!