I am working on an Angular 4 App. I am trying to get data from a JSON file for building a user dashboard.
I created a json file and tried loading it using JSON server using this: $ json-server --watch user.json and I am getting the following error:
Type of "id" (number) in user.json is not supported. Use objects or arrays of objects..
When I remove the "id" field in the file, I get the same error with "name".
I feel there is something wrong with the way I have created the json files. I am new to web development, so don't mind if it's a very fundamental mistake.
This is my json file:
{
"id": 1,
"name":"Kajal Agarwal",
"department":"Information Technology",
"college":"Indian Institute of Engineering Science and Technology, Shibpur",
"subjects":[
{
"title":"Data Structures",
"active":true,
"faculty":"Prasun Ghosal",
"notifications":4,
"color":"#9c27b0"
},
{
"title":"Operating System",
"active":true,
"faculty":"Niharika Singh",
"notifications":0,
"color":"#ffc107"
},
{
"title":"Algorithms",
"active":true,
"faculty":"Debojit Mondal",
"notifications":1,
"color":"#009688"
},
{
"title":"Web Technologies",
"active":true,
"faculty":"Shantanu Saurabh",
"notifications":2,
"color":"#ff5722"
},
{
"title":"Formal Language and Automata Theory",
"active":true,
"faculty":"Sudhanshu Sekhar",
"notifications":3,
"color":"#03a9f4"
},
{
"title":"Digital Logic and Circuit Design",
"active":false,
"faculty":"",
"notifications":0,
"color":"#9e9e9e"
}
]
}