You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a list of dictionaries. I want to read this file and store each dictionary into a map of vectors. Later I have to iterate over the each dictionary and extract key and values(which is a list in this case).
I have used the following code to do this:
class faults{
map<string, vector<string>> myMap;
};
std::ifstream myinput("fault_list.json");
auto j = json::parse(myinput);
std::vector fault = j;
I'm facing the following error:
error: conversion from 'nlohmann::basic_json<>' to non-scalar type 'std::vector' requested
std::vector fault = j;
^
What is the issue you have?
I'm having a json file as follows:
[
{
"top__DOT__comp_ac_Multiplier_Mux01__DOT__H11TW040L_UCVCSND2X010_Z_s": [
"sa0",
"sa1"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__INDEX02_Outp_s": [
"sa0",
"sa1"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__comp_H11TW040L_UCVCSND2X010__DOT__NOT00_Outp_s": [
"sa0"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__comp_H11TW040L_UCVCSND2X010__DOT__NOT01_Outp_s": [
"sa0"
]
},
{
"top__DOT__comp_ac_Multiplier_Mux01__DOT__H11TW040L_UCVCSAORI1X010_Z_s": [
"sa0",
"sa1"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__INDEX00_Outp_s": [
"sa1"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__INDEX01_Outp_s": [
"sa1"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__comp_H11TW040L_UCVCSAORI1X010__DOT__BAND_Outp_s": [
"sa0"
],
"top__DOT__comp_ac_Multiplier_Mux01__DOT__comp_H11TW040L_UCVCSAORI1X010__DOT__NOT_Outp_s": [
"sa0"
]
}
]
It is a list of dictionaries. I want to read this file and store each dictionary into a map of vectors. Later I have to iterate over the each dictionary and extract key and values(which is a list in this case).
I have used the following code to do this:
class faults{
};
std::ifstream myinput("fault_list.json");
auto j = json::parse(myinput);
std::vector fault = j;
I'm facing the following error:
error: conversion from 'nlohmann::basic_json<>' to non-scalar type 'std::vector' requested
std::vector fault = j;
^
Operating System: Unix
Compiler: g++ (GCC) 8.2.0
I used the json.hpp file from here
https://github.com/nlohmann/json/releases/tag/v3.9.1
Kindly help me with the issue.
The text was updated successfully, but these errors were encountered: