Im a begginer programmer, and im trying to make my first own, small project, that "extracts" values from JSON file, and then later through that i draw it in on javafx line chart. I was trying to find a solution for my problem of extracting values from JSON file (using json.simple or/and json.org) but i still cant manage to do it properly.
The inside of my json file is:
[
{
"Price": 7999,
"Id": 0,
"Datetime": "2020-06-09T21:55:55.335Z"
},
{
"Price": 7500,
"Id": 1,
"Datetime": "2020-06-10T21:55:55.335Z"
},
{
"Price": 7900,
"Id": 2,
"Datetime": "2020-06-11T21:55:55.335Z"
},
{
"Price": 6800,
"Id": 3,
"Datetime": "2020-06-12T21:55:55.335Z"
},
{
"Price": 6949,
"Id": 4,
"Datetime": "2020-06-13T21:55:55.335Z"
},
{
"Price": 9160,
"Id": 5,
"Datetime": "2020-06-14T21:55:55.335Z"
},
{
"Price": 7500,
"Id": 6,
"Datetime": "2020-06-15T21:55:55.335Z"
},
{
"Price": 6999,
"Id": 7,
"Datetime": "2020-06-16T21:55:55.335Z"
},
{
"Price": 7259,
"Id": 8,
"Datetime": "2020-06-17T21:55:55.335Z"
},
{
"Price": 7259,
"Id": 9,
"Datetime": "2020-06-18T21:55:55.335Z"
},
{
"Price": 6700,
"Id": 10,
"Datetime": "2020-06-19T21:55:55.335Z"
},
{
"Price": 5999,
"Id": 11,
"Datetime": "2020-06-20T21:55:55.335Z"
},
{
"Price": 5500,
"Id": 12,
"Datetime": "2020-06-21T21:55:55.335Z"
},
{
"Price": 6200,
"Id": 13,
"Datetime": "2020-06-22T21:55:55.335Z"
},
{
"Price": 6260,
"Id": 14,
"Datetime": "2020-06-23T21:55:55.335Z"
},
{
"Price": 5800,
"Id": 15,
"Datetime": "2020-06-24T21:55:55.335Z"
},
{
"Price": 5300,
"Id": 16,
"Datetime": "2020-06-25T21:55:55.335Z"
},
{
"Price": 5090,
"Id": 17,
"Datetime": "2020-06-26T21:55:55.335Z"
},
{
"Price": 4999,
"Id": 18,
"Datetime": "2020-06-27T21:55:55.335Z"
},
{
"Price": 4999,
"Id": 19,
"Datetime": "2020-06-28T21:55:55.335Z"
}
]
And im interested in extracting the "Price" and "Datetime" values from it. I was trying to use JSON Array and iterate through it, but iterator couldnt work (and i have no idea why). I was able to get the values into a graph using filereader and buffered reader (from simple .txt file filled with only raw price) but not from JSON. So how exactly i can do it?
This is my first post on stackoverflow and as i said im a beginner programmer, im sorry if my question is stupid, but i just cant do it even though i've been searching for solution for few hours now and none of them worked for me.
Thanks