JSON Not Well Formed - Inventory API

JSON Not Well Formed - Inventory API

Trying to create an item group via the API
however keep getting the error "json not well formed"

My JSON is perfectly valid as Ive ran it through a lot of validators 
All I have changed is added \ before the "  as its being passing in a string

Here is the code formatted for the string 
  1. JSONString='{\"group_name\": \"Test\",\"brand\": \"\",\"manufacturer\": \"\",\"unit\": \"qty\",\"description\": \"\",\"tax_id\":0 ,\"attribute_name1\": \"\",\"items\": [ { \"name\": \"Test Item\",\"rate\": 0,\"purchase_rate\":0 ,\"reorder_level\": 0,\"initial_stock\": 0,\"initial_stock_rate\": 0,\"vendor_id\": \"NULL\",\"sku\": \"\",\"upc\": 111111111111,\"ean\": 0,\"isbn\": 0,\"part_number\": 0,\"attribute_option_name1\": \"\"}],\"attributes\": [{\"id\": \"NULL\",\"name\": \"Test small\",\"options\": [{\"id\": \"NULL\",\"name\": \"Test Small\"}]}]}}'"
Here is the code without the \ before the "
  1. {"group_name": "Test","brand": "","manufacturer": "","unit": "qty","description": "","tax_id":0 ,"attribute_name1": "","items": [ { "name": "Test Item","rate": 0,"purchase_rate":0 ,"reorder_level": 0,"initial_stock": 0,"initial_stock_rate": 0,"vendor_id": "NULL","sku": "","upc": 111111111111,"ean": 0,"isbn": 0,"part_number": 0,"attribute_option_name1": ""}],"attributes": [{"id": "NULL","name": "Test small","options": [{"id": "NULL","name": "Test Small"}]}]}}
Ideally I wanted to add as little info as possible .. just the group name , unit  and 1 item ( just the required fields )
instead of having to include all the information like i have above

I really cant see what the issue is

Here is my complete cURL code ( without the auth token obviously )
  1. header('Content-Type: application/json');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://inventory.zoho.com/api/v1/itemgroups?authtoken=XXXXXXXXd&organization_id=674140431");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "JSONString='{\"group_name\": \"Test\",\"brand\": \"\",\"manufacturer\": \"\",\"unit\": \"qty\",\"description\": \"\",\"tax_id\":0 ,\"attribute_name1\": \"\",\"items\": [ { \"name\": \"Test Item\",\"rate\": 0,\"purchase_rate\":0 ,\"reorder_level\": 0,\"initial_stock\": 0,\"initial_stock_rate\": 0,\"vendor_id\": \"NULL\",\"sku\": \"\",\"upc\": 111111111111,\"ean\": 0,\"isbn\": 0,\"part_number\": 0,\"attribute_option_name1\": \"\"}],\"attributes\": [{\"id\": \"NULL\",\"name\": \"Test small\",\"options\": [{\"id\": \"NULL\",\"name\": \"Test Small\"}]}]}}'");
    curl_setopt($ch, CURLOPT_POST, true);
    $result = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'Error:' . curl_error($ch);
    }
    curl_close ($ch);
    echo $result;



    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now