Skip to content

Error Using JSON Library with arrays C++ #475

Closed
@JMcCASKI

Description

Hi,

I am using your json c++ libraryon a University project.

I am trying to create a json structure with an array of strings contained in it... along with some other information.

Whenever I try to add the array I get an error:
./json.hpp:843:9: error: static_assert failed "could not find to_json() method

  in T's namespace"

    static_assert(sizeof(BasicJsonType) == 0,

I have not implemented to_json() method if that is required, though, I am unsure how to do sure with you library implementation.

My code is along the lines of:

    // Store messageboard data with JSON Lib

    json mbData;    // Json file to hold messageboard information
    // Add to mbData

   

    mbData["messageBoard"] = 
    {
         mbMessage = {message}; // Store the array of strings here
        {"NumUser", "NumMessage"},
        {numUser, numMessage}
    };

where message is a string array each of char size 50 from the string.h lib.

Possibly you may know why this is happening ?

Thanks,

Josh McCaskill

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions