Skip to content

Jiiks/jsonhex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

jsonhex

Basic support for hex values with https://github.com/nlohmann/json

Currently only supports reading and all values are uint64_t

Usage:

#include "jsonhex.hpp"

// Instead of using
std::ifstream f(path);
auto data = nlohmann::json::parse(output);

// use
auto data = jsonhex::parse(path);

// done

Supports hex values anywhere so for example the following:

{
  "hexvalue": 0xDE0B6B3A763FFFF,
  "hexarr": [ 0xAE, 0x50 ]
}

Would be parsed to:

struct ParseMe {
  uint64_t HexValue; // 999999999999999999
  vector<int> HexArr; // [174, 80]
}

auto data = jsonhex::parse(path);
ParseMe p{};
data.at("hexvalue").get_to(p.HexValue);
data.at("hexarr").get_to(p.HexArr);

TODO

  • Serializing
  • Support for other types maybe

About

Support for hex values with https://github.com/nlohmann/json

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages