Help - Create & Save .JSON file on Mac


Preface: I searched and I’m a noob.

Body: In the webhooks example, it says: “Create a text file somewhere named librato.json.” I tried creating a text file with (Mac) TextEdit, but it will not let me save it with a .json file extension. What am I doing wrong?

Conclusion: [Insert your solution here]

have you tried to save it and rename it using finder?

there are lots of great editors for mac… e.g. TextWrangler

My noobdom precluded me from trying that. Thanks for the suggestion, it worked.

You can also paste in here… get formatting and error detection, and save to disk.

Thanks, BDub. At Bulldog’s suggestion, I downloaded TextWranger and will run with it for now.

A new question arose: is this the expected response from terminal?

bens-MacBook-Air:~ bentoskey$ spark webhook create librato.json
Please specify an event name

Generally I use vi to create all my .json files (because the Mac is notoriously annoying about mangling file extensions for developer-type files). I use an online JSON editor like the one BDub suggests, then I just copy the file to my clipboard and do:

vi foo.json
a (puts you in append mode)
[esc] : wq! (saves the file)

I know it’s ugly and low-level, but it’s one of the most reliable ways I know of editing JSON and not letting editor crap get stuffed in there. For example, if you use TextEdit, and you’re typing quotes, it will often use the directional quotes (left-slanted open quote and right-slanted close quote), which are unicode characters and will cause a JSON parser to choke.

1 Like

Is this in your .JSON file?

"eventName": "librato_",

I would use for analyzing, editing , formatting and minifing json, I love this tool to play with json object.