No version for distro humble showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro jazzy showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro kilted showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro rolling showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro galactic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro iron showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro melodic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange

No version for distro noetic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

json_struct package from json_struct repo

json_struct

ROS Distro
github

Package Summary

Tags No category tags.
Version 0.0.1
License MIT
Build type CMAKE
Use RECOMMENDED

Repository Summary

Description json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Checkout URI https://github.com/jorgen/json_struct.git
VCS Type git
VCS Version master
Last Updated 2025-10-11
Dev Status UNKNOWN
Released UNRELEASED
Tags c-plus-plus serialization json parse deserialization template-metaprogramming template-specialisations
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

json_struct is a single header only library that parses JSON to C++ structs/classes and serializing structs/classes to JSON.

Additional Links

No additional links.

Maintainers

  • Jørgen Lind

Authors

No additional authors.

Structurize your JSON

CI ClusterFuzzLite PR fuzzing

json_struct is a single-header C++ library that parses JSON to structs/classes and serializes structs/classes back to JSON. With support for relaxed parsing rules, it’s also excellent for configuration files and human-editable data formats.

Getting Started: Simply copy json_struct.h from the include folder into your project’s include path.

Requirements: C++11 or newer. Tested on GCC, Clang, and Visual Studio 2015+.

Quick Start

json_struct automatically maps JSON to C++ structs by adding simple metadata declarations.

{
    "One" : 1,
    "Two" : "two",
    "Three" : 3.333
}

can be parsed into a structure defined like this:

struct JsonObject
{
    int One;
    std::string Two;
    double Three;

    JS_OBJ(One, Two, Three);
};

or

struct JsonObject
{
    int One;
    std::string Two;
    double Three;
};
JS_OBJ_EXT(JsonObject, One, Two, Three);

Parse JSON to struct:

JS::ParseContext context(json_data);
JsonObject obj;
context.parseTo(obj);

Serialize struct to JSON:

std::string pretty_json = JS::serializeStruct(obj);
// or
std::string compact_json = JS::serializeStruct(obj, JS::SerializerOptions(JS::SerializerOptions::Compact));

Relaxed Parsing for Config Files

json_struct supports relaxed JSON parsing rules, making it ideal for configuration files and human-editable data. Enable optional features for a more forgiving syntax:

  • Comments using // syntax
  • Unquoted property names and string values (supports A-Z, a-z, 0-9, _, -, ., /)
  • Newlines instead of commas as delimiters
  • Trailing commas in objects and arrays

Example configuration file:

{
  // Server configuration
  host: localhost
  port: 8080

  database: {
    name: myapp_db
    max_connections: 100,  // Trailing comma is OK
  }

  log_file: /var/log/app.log
}

Enable relaxed parsing:

JS::ParseContext context(config_data);
context.tokenizer.allowComments(true);
context.tokenizer.allowAsciiType(true);
context.tokenizer.allowNewLineAsTokenDelimiter(true);
context.tokenizer.allowSuperfluousComma(true);
context.parseTo(config_obj);

Dynamic JSON with Maps

File truncated at 100 lines see the full file

CHANGELOG
No CHANGELOG found.

Package Dependencies

No dependencies on ROS packages.

System Dependencies

Name
cmake

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged json_struct at Robotics Stack Exchange