Bsoft  2.1.0
Bernard's software package
json.h
Go to the documentation of this file.
1 
8 #include <ostream>
9 #include <iostream>
10 #include <fstream>
11 #include <sstream>
12 #include <vector>
13 #include <map>
14 #include <type_traits>
15 
16 using namespace std;
17 
18 #ifndef _JSON_
19 #define _JSON_
20 
21 enum JStype {
28  JSnull
29 };
30 
31 // Prototypes
32 class JSvalue;
33 ostream& operator<<(ostream& output, JStype t);
34 ostream& operator<<(ostream& output, JSvalue& jsv);
35 
36 /*
37  The string s contains eiher the tag if the type is a pair
38  or the value if the type is a number or string.
39  The list v contains elements that could be:
40  a single value if type is a pair
41  an array of values if type is an array
42  an array of pairs if type is an object.
43  The last three types are the barewords: true, false and null
44  Type Str/Val Vec/Map
45  JSstring value -
46  JSbool t/f -
47  JSinteger long -
48  JSreal double -
49  JSobject - map
50  JSarray - vec
51  JSnull - -
52 */
53 class JSvalue { // 104
54 private:
55  JStype t; // 4 - aligned on 8
56  string s; // 24
57  bool b; // 1 - aligned on 8
58  long i; // 8
59  double r; // 8
60  vector<JSvalue> v; // 24
61  map<string, JSvalue> m; // 24
62  void clean_string(string val) {
63  if ( val.front() == '"' ) {
64  if ( val.back() == '"' ) s = val.substr(1,val.length() - 2);
65  else s = val.substr(1);
66  } else s = val;
67  }
68  void fail(string msg) {
69  cerr << "JSON error! " << msg << " (" << t << ")" << endl;
70  show_value(*this);
71  cerr << "array:" << endl;
72  for ( auto it = v.begin(); it != v.end(); ++it )
73  show_value(*it);
74  cerr << "object:" << endl;
75  for ( auto it = m.begin(); it != m.end(); ++it ) {
76  cerr << "tag: " << it->first << endl;
77  show_value(it->second);
78  }
79 // exit(-1);
80  }
81  void show_value(JSvalue& val) {
82  cerr << "string: \"" << s << "\"" << endl;
83  cerr << "boolean: " << b << endl;
84  cerr << "integer: " << i << endl;
85  cerr << "real: " << r << endl;
86  }
87 public:
88  JSvalue() : t(JSnull) { }
89  JSvalue(JStype tp) : t(tp) { }
90  JSvalue(bool tf) : t(JSbool), b(tf) { }
91  JSvalue(const char* val) : t(JSstring) { clean_string(val); }
92  JSvalue(const string& val) : t(JSstring) { clean_string(val); }
93  JSvalue(const int& val) : t(JSinteger) { i = val; }
94  JSvalue(const unsigned int& val) : t(JSinteger) { i = val; }
95  JSvalue(const long& val) : t(JSinteger) { i = val; }
96  JSvalue(const unsigned long& val) : t(JSinteger) { i = val; }
97  JSvalue(const float& val) : t(JSreal) { r = val; }
98  JSvalue(const double& val) : t(JSreal) { r = val; }
99  template <typename T>
100  JSvalue(const vector<T>& arr) : t(JSarray) {
101  v.clear();
102  for ( auto it = arr.begin(); it != arr.end(); ++it )
103  v.push_back(*it);
104  }
105 // JSvalue(const map<string, JSvalue>& mp) : t(JSobject) { m = mp; }
106  template <typename T>
107  JSvalue(const map<string, T>& mp) : t(JSobject) {
108  m.clear();
109  for ( auto it = mp.begin(); it != mp.end(); ++it )
110  m[it->first] = JSvalue(it->second);
111  }
112  const JStype& type() const { return t; }
113  // Size
114  size_t size() {
115  if ( t == JSarray ) return v.size();
116  else if ( t == JSobject ) return m.size();
117  else if ( t == JSstring ) return s.size();
118  else if ( t == JSnull ) return 0;
119  return 1;
120  }
121  void clear() {
122  if ( t == JSarray ) return v.clear();
123  else if ( t == JSobject ) return m.clear();
124  else if ( t == JSstring ) return s.clear();
125  }
126  long memory() {
127  long n(sizeof(JSvalue));
128  if ( t == JSarray ) for ( auto it: v ) n += it.memory();
129  else if ( t == JSobject ) for ( auto it: m ) n += it.first.size() + it.second.memory();
130  else if ( t == JSstring ) n += s.size();
131  return n;
132  }
133  // Access
134  string& value() {
135  if ( t != JSstring ) fail("value: Expected a string.");
136  return s;
137  }
138  bool& boolean() {
139  if ( t != JSbool ) fail("boolean: Expected a boolean.");
140  return b;
141  }
142  long& integer() {
143  if ( t != JSinteger ) {
144  if ( t != JSreal ) fail("integer: Expected an integer.");
145  else i = r;
146  }
147  return i;
148  }
149  double& real() {
150  if ( t != JSreal ) {
151  if ( t != JSinteger ) fail("real: Expected a real number.");
152  else r = i;
153  }
154  return r;
155  }
156  // Array access
157  vector<JSvalue>& array() {
158  if ( t != JSarray ) fail("array: Expected an array.");
159  return v;
160  }
161  JSvalue& operator[](long j) {
162  if ( t != JSarray ) fail("Expected an array.");
163  return v.at(j);
164  }
165  vector<long> array_integer() {
166  if ( t != JSarray ) fail("array_integer: Expected an array.");
167  vector<long> vec;
168  for ( auto it = v.begin(); it != v.end(); ++it )
169  vec.push_back(it->integer());
170  return vec;
171  }
172  vector<double> array_real() {
173  if ( t != JSarray ) fail("array_real: Expected an array.");
174  vector<double> vec;
175  for ( auto it = v.begin(); it != v.end(); ++it )
176  vec.push_back(it->real());
177  return vec;
178  }
180  if ( t != JSarray ) fail("front: Expected an array.");
181  return v.front();
182  }
184  if ( t != JSarray ) fail("back: Expected an array.");
185  return v.back();
186  }
187  vector<JSvalue>::iterator begin() { return v.begin(); }
188  vector<JSvalue>::iterator end() { return v.end(); }
189  vector<JSvalue>::iterator erase(long j) {
190  if ( t != JSarray ) fail("erase: Expected an array.");
191  return v.erase(v.begin()+j);
192  }
193  vector<JSvalue>::iterator erase(vector<JSvalue>::iterator first, vector<JSvalue>::iterator last) {
194  if ( t != JSarray ) fail("erase: Expected an array.");
195  return v.erase(v.begin(), v.end());
196  }
197  void push_back(const JSvalue& val) {
198  if ( t != JSarray ) fail("push_back: Expected an array.");
199  v.push_back(val);
200  }
201  // Object access
202  map<string, JSvalue>& object() {
203  if ( t != JSobject ) fail("Expected an object.");
204  return m;
205  }
206  JSvalue& operator[](string tag) {
207  if ( t != JSobject ) fail("Expected an object with tag " + tag + ".");
208  if ( m.find(tag) == m.end() ) m[tag] = JSvalue();
209  return m[tag];
210  }
211  JSvalue& object(string tag) {
212  if ( t != JSobject ) fail("object: Expected an object with tag " + tag + ".");
213  if ( m.find(tag) == m.end() ) fail("Tag " + tag + " not found.");
214  return m[tag];
215  }
216  JSvalue& at(string tag) {
217  if ( t != JSobject ) fail("at: Expected an object with tag " + tag + ".");
218  if ( m.find(tag) == m.end() ) fail("Tag " + tag + " not found.");
219  return m[tag];
220  }
221  bool exists(string tag) {
222  if ( t != JSobject ) fail("exists: Expected an object with tag " + tag + ".");
223  if ( m.find(tag) == m.end() ) return false;
224  return true;
225  }
226  long erase(string tag) {
227  if ( t != JSobject ) fail("erase: Expected an object with tag " + tag + ".");
228  return m.erase(tag);
229  }
230  map<string, JSvalue>::iterator object_begin() { return m.begin(); }
231  map<string, JSvalue>::iterator object_end() { return m.end(); }
232  map<string, JSvalue>::iterator erase(map<string, JSvalue>::iterator first, map<string, JSvalue>::iterator last) {
233  if ( t != JSobject ) fail("erase: Expected an object.");
234  return m.erase(first, last);
235  }
236  void append(JSvalue& obj) {
237  if ( t != JSobject ) fail("append: Expected an object.");
238  if ( obj.t != JSobject ) fail("append: Expected an object.");
239  m.insert(obj.object_begin(), obj.object_end());
240  }
241  // Simple type access
242  bool& boolean(string& tag) {
243  return object(tag).boolean();
244  }
245  long& integer(string& tag) {
246  return object(tag).integer();
247  }
248  double& real(string& tag) {
249  return object(tag).real();
250  }
251  vector<JSvalue>& array(string& tag) {
252  return object(tag).array();
253  }
254  // Relational operators
255  bool operator==(string val) {
256  return s == val;
257  }
258  bool operator!=(string val) {
259  return s != val;
260  }
261  // Computational operators
262  void operator+=(double d) {
263  if ( t == JSinteger ) i += d;
264  else if ( t == JSreal ) r += d;
265  else if ( t == JSarray )
266  for ( auto it = this->begin(); it != this->end(); ++it )
267  *it += d;
268  }
269  void operator*=(double d) {
270  if ( t == JSinteger ) i *= d;
271  else if ( t == JSreal ) r *= d;
272  else if ( t == JSarray )
273  for ( auto it = this->begin(); it != this->end(); ++it )
274  *it *= d;
275  }
276  void operator/=(double d) {
277  if ( d == 0 ) {
278  cerr << "Error: Divisor is zero!" << endl;
279  return;
280  }
281  if ( t == JSinteger ) i /= d;
282  else if ( t == JSreal ) r /= d;
283  else if ( t == JSarray )
284  for ( auto it = this->begin(); it != this->end(); ++it )
285  *it /= d;
286  }
287  // Queries
288  vector<JSvalue*> operator()(string& jsonpath) {
289 // cout << "Parsing path: " << jsonpath << endl;
290  vector<JSvalue*> qarr;
291  if ( jsonpath.find_first_of(".") < 2 ) qdots(jsonpath, qarr);
292  else qbrackets(jsonpath, qarr);
293 // cout << "Query size: " << qarr.size() << endl;
294  return qarr;
295  }
296  void qdots(string& jsonpath, vector<JSvalue*>& qarr) {
297  // cout << "jsonpath=" << jsonpath << endl;
298  size_t b1(jsonpath.find_first_of("."));
299  size_t b2(jsonpath.find_first_of("["));
300  // cout << b1 << "\t" << b2 << endl;
301  if ( b2 < b1 ) {
302  b1 = b2;
303  b2 = jsonpath.find_first_of("]", b1);
304  } else {
305  size_t b3(jsonpath.find_first_of(".", b1+1));
306  if ( b3 < b2 ) b2 = b3;
307  }
308  if ( b1 >= string::npos ) {
309  qarr.push_back(this);
310  return;
311  }
312  // cout << b1 << "\t" << b2 << endl;
313  if ( b2 >= string::npos ) b2 = jsonpath.length();
314  string tag(jsonpath.substr(b1+1,b2-b1-1));
315  string nupath(jsonpath.substr(b2)); // new path starts with '.' or '['
316  // cout << "tag=" << tag << endl;
317  // cout << "nupath=" << nupath << endl;
318  if ( t == JSarray ) {
319  if ( tag == "*" ) {
320  for ( auto it = begin(); it != end(); ++it )
321  it->qdots(nupath, qarr);
322  } else {
323  try { i = stol(tag); }
324  catch (...) { fail("No conversion to an integer."); }
325  v[i].qdots(nupath, qarr);
326  }
327  } else if ( t == JSobject ) {
328  if ( tag == "*" ) {
329  for ( auto it = object_begin(); it != object_end(); ++it )
330  it->second.qdots(nupath, qarr);
331  } else {
332  if ( tag[0] == '\'' )
333  tag = tag.substr(1, tag.find_last_of("'") - 1);
334  if ( tag[0] == '"' )
335  tag = tag.substr(1, tag.find_last_of("\"") - 1);
336  m[tag].qdots(nupath, qarr);
337  }
338  } else fail("Tag " + tag + " not found.");
339  }
340  void qbrackets(string& jsonpath, vector<JSvalue*>& qarr) {
341 // cout << "jsonpath=" << jsonpath << endl;
342  size_t b1(jsonpath.find_first_of("["));
343  if ( b1 == string::npos ) {
344  qarr.push_back(this);
345  return;
346  }
347  size_t b2(jsonpath.find_first_of("]"));
348  string tag(jsonpath.substr(b1+1,b2-b1-1));
349  string nupath(jsonpath.substr(b2+1));
350 // cout << "tag=" << tag << endl;
351  if ( t == JSarray ) {
352  if ( tag == "*" ) {
353  for ( auto it = begin(); it != end(); ++it )
354  it->qbrackets(nupath, qarr);
355  } else {
356  try { i = stol(tag); }
357  catch (...) { fail("No conversion to an integer."); }
358  v[i].qbrackets(nupath, qarr);
359  }
360  } else if ( t == JSobject ) {
361  if ( tag == "*" ) {
362  for ( auto it = object_begin(); it != object_end(); ++it )
363  it->second.qbrackets(nupath, qarr);
364  } else {
365  if ( tag[0] == '\'' )
366  tag = tag.substr(1, tag.find_last_of("'") - 1);
367  if ( tag[0] == '"' )
368  tag = tag.substr(1, tag.find_last_of("\"") - 1);
369  m[tag].qbrackets(nupath, qarr);
370  }
371  } else fail("Tag " + tag + " not found.");
372  }
373  void write(string filename) {
374  ofstream fjs(filename);
375  fjs << *this << endl;
376  fjs.close();
377  }
378 };
379 
380 /*
381  The following incorrect syntax is ignored:
382  Any content after the top-level closing bracket
383  Any fields before or after commas that only contain white space
384  Any white space within numeric fields or leading zeroes
385 */
386 class JSparser {
387 private:
388  string content;
389  string::iterator it;
390  void read(string filename) {
391 // cout << "Reading " << filename << endl;
392  ifstream f(filename);
393  if ( f.fail() ) {
394  cerr << "Error: File " << filename << " not opened" << endl;
395  return;
396  }
397  f.seekg(0, ios::end);
398  content.resize(f.tellg());
399 // cout << "Length = " << content.size() << endl;
400  f.seekg(0, ios::beg);
401  f.read(&content[0], content.size());
402  f.close();
403  }
404  void fail(string msg) {
405  long i;
406  cerr << "JSON parser error! " << msg << " (";
407  for ( i=0; it!=content.end() && i<10 ; ++it, ++i ) cerr << *it;
408  if ( i >= 10 ) cerr << "...";
409  cerr << ")" << endl;
410  exit(-1);
411  }
412 public:
413  JSparser() {};
414  JSparser(string filename) { read(filename); }
415  JSparser(const char* buf, size_t n) { content = string(buf, n); }
417  JSvalue val;
418  for ( it=content.begin(); it!=content.end(); ++it ) {
419  if ( *it == '{' ) return parseJSobject();
420  else if ( *it == '[' ) return parseJSarray();
421  else if ( !isspace(*it) ) break;
422  }
423  fail("No { or [ found at the start.");
424  return val;
425  }
426  JSvalue parse(string filename) {
427  read(filename);
428  return parse();
429  }
430 private:
431  JSvalue parseJSvalue() {
432  JSvalue val;
433  for ( ; it!=content.end() && *it != '}' && *it != ']' && *it != ','; ++it ) {
434  if ( *it == '{' ) {
435  return parseJSobject();
436  } else if ( *it == '[' ) {
437  return parseJSarray();
438  } else if ( *it == '"' ) {
439  return parseJSstring();
440  } else if ( isdigit(*it) || *it == '.' || *it == '+' || *it == '-' ) {
441  return parseJSnumber();
442  } else if ( *it == 't' || *it == 'f' || *it == 'n' ) {
443  return parseJSbare();
444  } else if ( !isspace(*it) ) {
445  fail("Found an unquoted string.");
446  }
447  }
448  return val;
449  }
450  string parseString() {
451  string s;
452  for ( ; it!=content.end() && *it != '"'; ++it )
453  if ( !isspace(*it) ) fail("Unquoted string.");
454  if ( *it != '"' ) fail("No opening quote on a string.");
455  for ( ++it; it!=content.end(); ++it ) {
456  if ( *it == '\\' ) { s += *it; ++it; s += *it; }
457  else if ( *it == '"' ) break;
458  else s += *it;
459 // cout << *it;
460  }
461 // cout << s << " \"" << *it << "\"" << endl;
462  if ( *it != '"' ) fail("No closing quote on a string.");
463  ++it;
464  return s;
465  }
466  JSvalue parseJSstring() {
467  string s(parseString());
468  return JSvalue(s);
469  }
470  JSvalue parseJSnumber() {
471  string s;
472  int ft(0);
473  for ( ; it!=content.end() && *it != '}' && *it != ']'
474  && *it != ',' && !isspace(*it); ++it ) {
475  if ( *it == '.' || *it == 'e' ) ft = 1;
476  if ( *it == 'x' ) fail("Numbers cannot be hex");
477  s += *it;
478  }
479  long l;
480  double d;
481  if ( ft ) {
482  try { d = stod(s); }
483  catch (...) { fail("No conversion to a real number."); }
484  return JSvalue(d);
485  } else {
486  try { l = stol(s); }
487  catch (...) { fail("No conversion to an integer."); }
488  return JSvalue(l);
489  }
490  }
491  JSvalue parseJSbare() {
492  string s;
493  for ( ; it!=content.end() && !isspace(*it) && *it != ',' && *it != '}'; ++it )
494  s += *it;
495  if ( s.compare("true") == 0 ) {
496  return JSvalue(true);
497  } else if ( s.compare("false") == 0 ) {
498  return JSvalue(false);
499  } else if ( s.compare("null") == 0 ) {
500  return JSvalue();
501  } else fail("Bare word " + s + " not allowed!");
502  return JSvalue();
503  }
504  JSvalue parseJSarray() {
505  it++;
506  JSvalue arr(JSarray);
507  for ( ; it!=content.end() && *it != ']'; ++it ) {
508 // cout << *it << endl;
509  if ( !isspace(*it) && *it != '}' && *it != ',' )
510  arr.push_back(parseJSvalue());
511 // cout << "parseJSarray:'" << *it << "'" << endl;
512  if ( *it == ':' ) fail("Unexpected colon.");
513  if ( it==content.end() || *it == ']' ) break;
514  }
515  if ( *it != ']' ) fail("No closing bracket on an array.");
516  it++;
517 // cout << "Parsing array" << *it << endl;
518  return arr;
519  }
520  JSvalue parseJSobject() {
521  it++;
522  string tag;
523  JSvalue obj(JSobject);
524  for ( ; it!=content.end() && *it != '}'; ++it ) {
525  if ( !isspace(*it) && *it != ']' && *it != ',' ) {
526  tag = parseString();
527  for ( ; it!=content.end() && isspace(*it); ++it ) ;
528  if ( *it != ':' ) fail("Expected a colon.");
529  it++;
530  obj[tag] = parseJSvalue();
531  }
532  if ( it==content.end() || *it == '}' ) break;
533  }
534  if ( *it != '}' ) fail("No closing bracket on an object.");
535  it++;
536  return obj;
537  }
538 };
539 
540 #endif // _JSON_
541 
542 
543 
544 
JSvalue::object_begin
map< string, JSvalue >::iterator object_begin()
Definition: json.h:230
JSarray
@ JSarray
Definition: json.h:27
JSvalue::JSvalue
JSvalue(const unsigned long &val)
Definition: json.h:96
JSvalue::memory
long memory()
Definition: json.h:126
JSvalue::array
vector< JSvalue > & array(string &tag)
Definition: json.h:251
JSvalue::clear
void clear()
Definition: json.h:121
JSvalue::erase
vector< JSvalue >::iterator erase(long j)
Definition: json.h:189
JSvalue::qdots
void qdots(string &jsonpath, vector< JSvalue * > &qarr)
Definition: json.h:296
JSvalue::real
double & real()
Definition: json.h:149
JSnull
@ JSnull
Definition: json.h:28
JSvalue::begin
vector< JSvalue >::iterator begin()
Definition: json.h:187
JStype
JStype
Definition: json.h:21
JSparser::JSparser
JSparser()
Definition: json.h:413
JSvalue::JSvalue
JSvalue(const double &val)
Definition: json.h:98
JSparser::parse
JSvalue parse()
Definition: json.h:416
JSstring
@ JSstring
Definition: json.h:22
JSvalue::JSvalue
JSvalue(const string &val)
Definition: json.h:92
JSvalue::JSvalue
JSvalue()
Definition: json.h:88
JSparser::JSparser
JSparser(const char *buf, size_t n)
Definition: json.h:415
JSvalue::real
double & real(string &tag)
Definition: json.h:248
JSvalue::array
vector< JSvalue > & array()
Definition: json.h:157
JSparser::parse
JSvalue parse(string filename)
Definition: json.h:426
JSparser
Definition: json.h:386
JSvalue::back
JSvalue & back()
Definition: json.h:183
JSvalue::end
vector< JSvalue >::iterator end()
Definition: json.h:188
JSinteger
@ JSinteger
Definition: json.h:24
JSvalue::type
const JStype & type() const
Definition: json.h:112
JSvalue::operator+=
void operator+=(double d)
Definition: json.h:262
JSvalue::exists
bool exists(string tag)
Definition: json.h:221
JSreal
@ JSreal
Definition: json.h:25
JSvalue::operator[]
JSvalue & operator[](long j)
Definition: json.h:161
JSvalue::object
map< string, JSvalue > & object()
Definition: json.h:202
JSvalue
Definition: json.h:53
JSvalue::value
string & value()
Definition: json.h:134
JSvalue::JSvalue
JSvalue(const map< string, T > &mp)
Definition: json.h:107
JSvalue::at
JSvalue & at(string tag)
Definition: json.h:216
JSparser::JSparser
JSparser(string filename)
Definition: json.h:414
JSvalue::operator()
vector< JSvalue * > operator()(string &jsonpath)
Definition: json.h:288
JSvalue::push_back
void push_back(const JSvalue &val)
Definition: json.h:197
JSvalue::boolean
bool & boolean()
Definition: json.h:138
JSvalue::object_end
map< string, JSvalue >::iterator object_end()
Definition: json.h:231
JSvalue::operator*=
void operator*=(double d)
Definition: json.h:269
JSvalue::array_real
vector< double > array_real()
Definition: json.h:172
JSvalue::JSvalue
JSvalue(JStype tp)
Definition: json.h:89
JSvalue::JSvalue
JSvalue(const char *val)
Definition: json.h:91
JSvalue::array_integer
vector< long > array_integer()
Definition: json.h:165
JSvalue::integer
long & integer(string &tag)
Definition: json.h:245
JSvalue::JSvalue
JSvalue(bool tf)
Definition: json.h:90
JSvalue::JSvalue
JSvalue(const float &val)
Definition: json.h:97
JSobject
@ JSobject
Definition: json.h:26
JSbool
@ JSbool
Definition: json.h:23
JSvalue::append
void append(JSvalue &obj)
Definition: json.h:236
JSvalue::front
JSvalue & front()
Definition: json.h:179
JSvalue::JSvalue
JSvalue(const unsigned int &val)
Definition: json.h:94
JSvalue::operator/=
void operator/=(double d)
Definition: json.h:276
JSvalue::JSvalue
JSvalue(const vector< T > &arr)
Definition: json.h:100
JSvalue::operator!=
bool operator!=(string val)
Definition: json.h:258
JSvalue::integer
long & integer()
Definition: json.h:142
JSvalue::erase
vector< JSvalue >::iterator erase(vector< JSvalue >::iterator first, vector< JSvalue >::iterator last)
Definition: json.h:193
JSvalue::erase
map< string, JSvalue >::iterator erase(map< string, JSvalue >::iterator first, map< string, JSvalue >::iterator last)
Definition: json.h:232
JSvalue::object
JSvalue & object(string tag)
Definition: json.h:211
JSvalue::boolean
bool & boolean(string &tag)
Definition: json.h:242
operator<<
ostream & operator<<(ostream &output, JStype t)
Definition: json.cpp:10
JSvalue::write
void write(string filename)
Definition: json.h:373
JSvalue::erase
long erase(string tag)
Definition: json.h:226
JSvalue::size
size_t size()
Definition: json.h:114
JSvalue::operator==
bool operator==(string val)
Definition: json.h:255
JSvalue::operator[]
JSvalue & operator[](string tag)
Definition: json.h:206
JSvalue::JSvalue
JSvalue(const int &val)
Definition: json.h:93
JSvalue::qbrackets
void qbrackets(string &jsonpath, vector< JSvalue * > &qarr)
Definition: json.h:340
JSvalue::JSvalue
JSvalue(const long &val)
Definition: json.h:95