Read from text file?

Hi,

I'd like to ask for help on how to extract certain lines from a txt file.
The text file is like:
"attackComplexity" : "LOW",\r\n "privilegesRequired" : "NONE",\r\n "userInteraction" : "NONE",\r\n "scope" : "UNCHANGED",\r\n "confidentialityImpact" : "HIGH",\r\n "integrityImpact" : "HIGH",\r\n "availabilityImpact" : "HIGH",\r\n "baseScore" : 9.8,\r\n "baseSeverity" : "CRITICAL"\r\n },\r\n "exploitabilityScore" : 3.9,\r\n "impactScore" : 5.9\r\n },\r\n "baseMetricV2" : {\r\n "cvssV2" : {\r\n "version" : "2.0",\r\n "vectorString" : "AV:N/AC:L/Au:N/C:P/I:P/A:P",\r\n "accessVector" : "NETWORK",\r\n "accessComplexity" : "LOW",\r\n "authentication" : "NONE",\r\n "confidentialityImpact" : "PARTIAL",\r\n "integrityImpact" : "PARTIAL",\r\n "availabilityImpact" : "PARTIAL",\r\n "baseScore" : 7.5\r\n },\r\n "severity" : "HIGH",\r\n "exploitabilityScore" : 10.0,\r\n "impactScore" : 6.4,\r\n "acInsufInfo" : false,\r\n "obtainAllPrivilege" : false,\r\n "obtainUserPrivilege"

And i like to get those rows which after the title like attackComplexity (LOW), userInteraction (NONE), and so on.
Thanks.

As it's pretty much JSON minus the starting{ and ending } I'd probably ....

  • add the curly brackets
  • Send it through a JSON node
  • Access any property I need by member (e.g. msg.payload.obtainAllPrivilege)

Okay, and how can i do all of that?

File in node - function node - JSON node - debug node.

Function node code ....

msg.payload = "{" + msg.payload + "}";
return msg;

Ps, read the docs, search the forum, watch some videos. There is some amazing info available.