What is the issue you have?
Everytime I run the program it throws a parse error (json file is valid)
Please describe the steps to reproduce the issue.
- Download the <json.hpp>
2.Include it
- Do some coding and compile
Can you provide a small but working code example?
#ifndef EXT_H
#define EXT_H
#include <json.hpp>
#include <fstream>
#include <iostream>
using namespace std;
using namespace nlohmann;
void LoadExtension()
{
ifstream file("../test.json");
json data;
file >> data;
cout << data << endl;
//test
}
#endif // !EXT_H
What is the expected behavior?
Show the entire json file
And what is the actual behavior instead?
Error message:
terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal
make: *** [Makefile:17: run] Aborted (core dumped)
Which compiler and operating system are you using?
Manjaro linux 21 with g++
This is the MakeFile:
CXX := g++
CXX_FLAGS := -Wall -Wextra -std=c++11 -ggdb -Werror -O3
BIN := bin
SRC := src
INCLUDE := include
LIB := lib
LIBRARIES :=
EXECUTABLE := main
all: $(BIN)/$(EXECUTABLE)
run: clean all
clear
./$(BIN)/$(EXECUTABLE)
$(BIN)/$(EXECUTABLE): $(SRC)/*.cpp
$(CXX) $(CXX_FLAGS) -I$(INCLUDE) -L$(LIB) $^ -o $@ $(LIBRARIES)
clean:
-rm $(BIN)/*
build:
clean all
$(BIN)/$(EXECUTABLE): $(SRC)/*.cpp
$(CXX) $(CXX_FLAGS) -I$(INCLUDE) -L$(LIB) $^ -o $@ $(LIBRARIES)
Which version of the library did you use?
What is the issue you have?
Everytime I run the program it throws a parse error (json file is valid)
Please describe the steps to reproduce the issue.
2.Include it
Can you provide a small but working code example?
What is the expected behavior?
Show the entire json file
And what is the actual behavior instead?
Error message:
Which compiler and operating system are you using?
Manjaro linux 21 with g++
This is the MakeFile:
Which version of the library did you use?
developbranchIf you experience a compilation error: can you compile and run the unit tests?