Arduino Json library query; Atmega2560

Discussion in 'Embedded Systems and Microcontrollers' started by Vindhyachal Takniki, Oct 14, 2016.

  1. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    For JSOn format using this library:

    1. I have defined Json using:
    StaticJsonBuffer<80> jsonBuffer;
    JsonArray& array = jsonBuffer.createArray();

    2. Now I keep on using add operator like as below & keep on adding values in array like this:

    3. After one loop, I want to reinit the Json array index to 0 again. So that when I now add values , it should again start from index 0. How to do that?

    4. Second question is how to know how much array size is filled in Json array at any point of time. This will help in case, intiially I will define a large array, now when I keep on adding values in it, in the end I want to know whats its size know. So that I can optimize the size of initially defined Json array.

    In the end I have to send this JSON generated string on SIM800 on a known IP address & port number.