I am accessing the data from azure mobile service using an Edison. The data is a json string. How can I parse the data to get the appropriate value? I have used the ArduinoJson library but I got multiple errors, when I compile it. Basically, how to use the ArduinoJson library in Edison?
The error is shown below
C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\JsonVariant.cpp: In member function 'T ArduinoJson::JsonVariant::as() const [with T = String]':
C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\JsonVariant.cpp:67:46: error: call of overloaded 'String(const double&, uint8_t&)' is ambiguous
return String(_content.asDouble, decimals);
^
C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\JsonVariant.cpp:67:46: note: candidates are:
In file included from C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/Print.h:26:0,
from C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\../include/ArduinoJson/Internals/../Arduino/Print.hpp:29,
from C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\../include/ArduinoJson/Internals/DummyPrint.hpp:9,
from C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\../include/ArduinoJson/Internals/JsonPrintable.hpp:9,
from C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\../include/ArduinoJson/JsonVariant.hpp:12,
from C:\Users\Avirup\Documents\Arduino\libraries\ArduinoJson\src\JsonVariant.cpp:7:
C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/WString.h:73:11: note: String::String(long unsigned int, unsigned char)
explicit String(unsigned long, unsigned char base=10);
^
C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/WString.h:72:11: note: String::String(long int, unsigned char)
explicit String(long, unsigned char base=10);
^
C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/WString.h:71:11: note: String::String(unsigned int, unsigned char)
explicit String(unsigned int, unsigned char base=10);
^
C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/WString.h:70:11: note: String::String(int, unsigned char)
explicit String(int, unsigned char base=10);
^
C:\Users\Avirup\AppData\Roaming\Arduino15\packages\Intel\hardware\i686\1.6.2+1.0\cores\arduino/WString.h:69:11: note: String::String(unsigned char, unsigned char)
explicit String(unsigned char, unsigned char base=10);
^
Error compiling.
Link Copied
Hi Avirup171,
Thank you for the post. I will forward your inquiry to Edison support.
rgds,
wb
Hello Avirup171,
I found the following ArduinoJson library, and it states that it is Edison compatible, however I tried to compile an example and I got the same errors as you: https://github.com/bblanchon/ArduinoJson bblanchon/ArduinoJson · GitHub
Apparently this is a known issue when using this library with Edison. I recommend you to check the following site where there are details about this issue: https://github.com/bblanchon/ArduinoJson/wiki/Compatibility-issues Compatibility issues · bblanchon/ArduinoJson Wiki · GitHub
You will find that a workaround is to add the following line in the WString.h file:
const char * c_str() const { return buffer; }
You should add that line as shown in here: https://github.com/bblanchon/corelibs-edison/commit/bb21686a709136c37706c678cd40327323a560e4 Add String::c_str() · bblanchon/corelibs-edison@bb21686 · GitHub
There are more details about this issue in the following site: https://github.com/bblanchon/ArduinoJson/issues/123 Intel Edison : String has no member named c_str · Issue # 123 · bblanchon/ArduinoJson · GitHub
Regards,
Diego.
Hello,
Thanks for the answer. After posting the question here, I looked over the issue you mentioned and apparently only adding that (c_str() ) line won't solve the error. Have a look over here. http://diffchecker.com/pzhscm6k http://diffchecker.com/pzhscm6k Some more lines are missing in Wstring.h. The line numbers 61,72,73 and line number 163. These lines should be added in the Wstring.h. Adding these lines solved the error.
For more complete information about compiler optimizations, see our Optimization Notice.