{“component”:{“key”:“repo1”,“name”:“repo1”,“description”:“TEST.”,“qualifier”:“TRK”,“measures”:[{“metric”:“complexity”,“value”:“12345”},{“metric”:“ncloc”,“value”:“6789”},{“metric”:“violations”,“value”:“147”,“bestValue”:false}]}}
I’m getting this JSON response (with modified values due to privacy) from SonarQube. When importing to EazyBI from RestAPI I’d like to make each ‘metric’ a column. The question is: how do I parse when the responses are not static? The JSON responses are not fixed - each return will have them ordered diferently so using the JS Path $.measures[#] (where # = the property(I think it’s a property)).
What I’ve tried:
const json = doc.component.measures;
const obj = JSON.parse(json);
return obj.measures[*].complexity
This doesn’t even execute. I get a token error “SyntaxError: Unexpected token: o”
This is a screenshot of the data in Firefox: