I am communicating with my GoPro via ESP8266 and GET requests.
One of the replies returns a set of predefined number and what I would like to do is extract the number on position "38". This is what the reply looks like in full:


+IPD,4,163:HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Sun, 24 Apr 2016 03:13:40 GMT
Server: Cherokee/1.2.101b150714_bd80061 (UNIX)
Content-type: application/json





As you can see, position 38=0 (...,"38":0,...). The number 0 will increment. So I would like to find the string "38": and do something with following numbers until ,.

What is the correct way to grab that number from the serial reply and echo or do something with it?

  • Are you using an Arduino to see the serial reply ? Or are you directly connected to the ESP8266 via USB?
    – Aswin P J
    Apr 24 '16 at 3:20
  • USB <-> Teensy <-> ESP ~~~~ GoPro
    – Fid
    Apr 24 '16 at 14:36

Since you are being returned JSON, you can use the jsoncpp library found here To split your return to an array. Then you simply retrieve whatever item you want using array index notation.

Here is another helpful post on creating arrays of strings in C++ from JSON. C++ and JSON


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.