Say that the databag I am using is missing a bracket or comma, is there a way to check that within a script?
Asked
Active
Viewed 407 times
1
-
`JSON.parse` and see if it succeeds? – sethvargo Jun 04 '14 at 22:45
1 Answers
1
Maybe its not a direct answer you are expecting , Let me say how I validate the data bags.
I always start with creating a json file which I will use for populating data bag. Let me outline the step I follow and it always worked for me.
Create data bag
knife data bag create example1
Create json file:
/tmp/example1_data.json
:{ "id": "id1", "name": "example1" }
Validate the json file
python -mjson.tool /tmp/example1_data.json
This will tell you whether the json file is validate or not
4 . populate data bag items
knife data bag from file example1 /tmp/example1.json

Robert
- 10,403
- 14
- 67
- 117

skanagasabap
- 910
- 3
- 12
- 24