I am working with a JSON object that contains the following values.
{
"articles":[
{
"paper-id":"id",
"paper-id-type":"type",
"title":"title",
"url":"url",
"abstract":"abs",
"date":"date",
"publication-forum":"forum",
"publication-forum-type":"type",
"authors":"auth",
"keywords":"key1,key2"
}
}
My goal was to access and manipulate these results using JavaScript. I initialized an array and stored the results in it.
The structure of the 'articles' array object is as follows;
abstract: "xxx"
authors: "yyy"
date: "1111"
keywords: "key1, key2"
paper-id: "abc"
paper-id-type: "xxx"
publication-forum: "yyy"
publication-forum-type: "zzz"
title: "www"
url: "url"
While trying to retrieve each value from these elements, I encountered a challenge due to the presence of "-" character in some keys. For example, when attempting to obtain the paper-id information;
articles[0]["paper-id"]
This resulted in an error message stating
[Exception: SyntaxError: Unexpected token []
.
If you have any suggestions on how to resolve this issue, please share your insights.