HIPO  4.3.0
High Performance Output data format for experimental physics
hipo::jsonutil Class Reference

Simple JSON parsing and value extraction utility. More...

#include <jsonutil.h>

Public Member Functions

 jsonutil ()
 
virtual ~jsonutil ()
 
void set (const char *json_string)
 Parse a JSON string into the internal object. More...
 
bool hasObject (const char *var)
 Check whether a key exists in the parsed JSON. More...
 
float getFloat (const char *var)
 Get a float value by key from the parsed JSON. More...
 

Detailed Description

Simple JSON parsing and value extraction utility.

Wraps nlohmann::json to provide a minimal interface for parsing JSON strings and extracting values by key.

Definition at line 57 of file jsonutil.h.

Constructor & Destructor Documentation

◆ jsonutil()

hipo::jsonutil::jsonutil ( )
inline

Definition at line 65 of file jsonutil.h.

◆ ~jsonutil()

virtual hipo::jsonutil::~jsonutil ( )
inlinevirtual

Definition at line 66 of file jsonutil.h.

Member Function Documentation

◆ getFloat()

float hipo::jsonutil::getFloat ( const char *  var)
inline

Get a float value by key from the parsed JSON.

Parameters
varKey name
Returns
Float value associated with the key

Definition at line 78 of file jsonutil.h.

◆ hasObject()

bool hipo::jsonutil::hasObject ( const char *  var)
inline

Check whether a key exists in the parsed JSON.

Parameters
varKey name to check
Returns
True if the key exists, false otherwise

Definition at line 74 of file jsonutil.h.

◆ set()

void hipo::jsonutil::set ( const char *  json_string)
inline

Parse a JSON string into the internal object.

Parameters
json_stringJSON formatted string to parse

Definition at line 70 of file jsonutil.h.


The documentation for this class was generated from the following file: