Manipulation of json

Guest #7240917
Rate this post
useful
not useful
Test schrieb:
> I want to read it in an array and add one pair [7,8].

You can write a simple JSON parser that does just that. Or you use a 
general JSON parsing library and construct your data structure with it. 
I guess adding the additional pair does not require any JSON business.

KR, Sebastian
Guest #7241012
Rate this post
useful
not useful
Hello i tried it
1
#include <iostream>
2
#include "ArduinoJson.h"
3

4
int main() {
5
 
6
  StaticJsonDocument<300> doc;
7

8
  char json[] =
9
      "[[48.756080,2.302038],[48.756080,2.302038]]";
10

11

12
  DeserializationError error = deserializeJson(doc, json);
13

14

15
  if (error) {
16
    std::cerr << "deserializeJson() failed: " << error.c_str() << std::endl;
17
    return 1;
18
  }
19

20
  
21
  double longitude = doc[0];
22

23
  // Print values.
24
    std::cout << longitude << std::endl;


But the output is 0. WHat is wrong??

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now