0

I want to upload a form from json like this:

{
  num: 1,
  falseBool: false,
  trueBool: true,
  empty: '',
  und: undefined,
  nullable: null,
  date: new Date(),
  name: 'str',
  another_object: {
    name: 'my_name',
    value: 'whatever'
  },
  array: [
    {
      key1: {
        name: 'key1'
      }
    }
  ]
};

how should I use libcurl form add to cpmplete this ?

273K
  • 29,503
  • 10
  • 41
  • 64
李相升
  • 1
  • 1
  • exactly, I don’t know how to deal with another_object and array ! – 李相升 Dec 10 '21 at 06:34
  • This is not a valid json. – 273K Dec 10 '21 at 07:51
  • Does this answer your question? [JSON requests in C using libcurl](https://stackoverflow.com/questions/11973994/json-requests-in-c-using-libcurl) [How do I POST a buffer of JSON using libcurl?](https://stackoverflow.com/questions/8251325/how-do-i-post-a-buffer-of-json-using-libcurl) – 273K Dec 10 '21 at 07:54
  • I notes that you used CURLOPT_POSTFIELDS to post json data, this is difference with curl_formadd, mybe some difference betoween form and json data. – 李相升 Dec 15 '21 at 06:28

0 Answers0