I am dealing with data which is structured (by a third party) with special characters; like so:
"pageFansGenderAge": {
"current": {
"U.13-17": 1,
"U.55-64": 246,
"M.55-64": 11925,
"U.35-44": 370,
"F.45-54": 16443,
"M.18-24": 8996,
"M.35-44": 20641,
"F.25-34": 11687,
"U.65+": 148,
"U.18-24": 42,
"M.25-34": 22341,
"F.13-17": 177,
"U.45-54": 415,
"F.65+": 5916,
"F.55-64": 12172,
"M.13-17": 141,
"M.65+": 6576,
"F.35-44": 14491,
"U.25-34": 178,
"M.45-54": 17979,
"F.18-24": 5787
},
GraphQL is throwing errors as it can't accept special characters, the full-stop and the hyphen are causing issues. Is there a known way to parse these in to stop the errors? Simply removing all the special characters (obvs) just returns null values.
Thanks in advance.
I have found a work around.
I can return the current data as JSON. Thanks to this stack-overflow answer:
Answer: Use 'scalar JSON' in your GraphQL query
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.