Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ATT_WNCInterface_Info WNCInterface_HTTP_example NerfUS-Coord Mbed_Prototype_copy_4_INNO_day_15_6_2017 ... more
C++ JSON wrapper over JSMN lib (https://github.com/zserge/jsmn).
This C++ Class is a set of common tools/procedures as a C++ wrapper over JSMN JSON parser library. It is intended to provide the boiler-plate code, with intentions to reduce code clutter, in more of C++ fashion.
In contrast to original library, Json is intended to work strictly with valid JSON structures. Non-standard JSON structures should result in an error.
This class works explicitly on the indices returned by underlying JSMN library. In the scope of this class, its function parameters, return types, and documentation, the term 'index' will always mean the index of JSMN tokens, parsed by the Json constructor, unless and until explicitly mentioned otherwise.
Revision 2:d33e3dbe6d07, committed 2016-05-17
- Comitter:
- mercurywaters
- Date:
- Tue May 17 05:29:03 2016 +0000
- Parent:
- 1:6193fe1e33e0
- Child:
- 3:fab591fca1e7
- Commit message:
- Added check for invalid parsing of JSON
Changed in this revision
| include/Json.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/include/Json.h Fri May 13 06:14:51 2016 +0000
+++ b/include/Json.h Tue May 17 05:29:03 2016 +0000
@@ -21,6 +21,7 @@
int findChildIndexOf ( const int &parentIndex, const int &startingAt ) const;
bool matches ( const int & tokenIndex, const char * value ) const;
+ inline bool isValidJson () { return ( tokenCount >= 1 ); };
inline jsmntype_t type ( const int tokenIndex ) const { return tokens [ tokenIndex ].type; };
inline int parent ( const int tokenIndex ) const { return tokens [ tokenIndex ].parent; };
inline int childCount ( const int tokenIndex ) const { return tokens [ tokenIndex ].childCount; };

