![bbedit pretty json bbedit pretty json](https://i.ytimg.com/vi/-fNlzEd18JE/hqdefault.jpg)
So one common problem arises when you copy the last item from an array, and paste it in somewhere, and forget the comma. You always need a comma between each item in an array. If you look at the white arrows, you'll see that there's a comma after the first item, but not after the last. This array has 2 items in it - the one highlighted in yellow, and the one highlighted in green. In the above image, the red arrows point to a set of square brackets, which define an array. One thing to be aware of in JSON is the use of commas in arrays: To make it easier for you to escape strings, check out the various Utility - Encode macros. The one at the end might be confusing - just remember that the entire string is enclosed in double-quotes, so there will always be a double-quote at the start, and one at the end. Notice the "backslash" before each double-quote. In the example above, notice the double-quotes in this action's description: There are certain characters in JSON that need to be "escaped". So be careful, for example, if you wanted to replace a string like "Variable". Compare it to the image above, and it should start to make sense. For example, consider these actions:īelow, I've highlighted in yellow the only things you should change in the JSON.
![bbedit pretty json bbedit pretty json](https://www.educba.com/academy/wp-content/uploads/2020/12/Sublime-Pretty-JSON-1.1-768x342.png)
![bbedit pretty json bbedit pretty json](https://cdn.educba.com/academy/wp-content/uploads/2020/05/Json-Pretty-output-2.png)
Only change what you could change in the KM editor. When you look at the object text, it should be pretty obvious it follows a specific pattern. What are the "rules" for editing JSON or XML? Still, if a translation problem arises, you can use XML. So why did I bother to include XML? As I said, XML is the native format KM uses, so it's remotely possible that converting it to JSON could introduce some translation errors, although I think I handle any possible problems. Use JSON, because it's more compact and easier to read. XML is the native format KM uses for importing and exporting macros. JSON is a newer standard, and much easier to read. JSON and XML are ways to represent computer data in a text format. And you can work on a copy of your macro, which makes it even less likely you'll mess things up.Īs I mentioned earlier, I've been using these macros for around 4 years, and I've never come across anything that couldn't be fixed easily with "undo". You can always "undo" your changes in the KM editor. You're working on a copy of a small part of the source, which you paste back into KM when you're done, so if you mess something up, chances are it won't even paste back into the KM editor.
#Bbedit pretty json code#
Most of the time you'll delete the original objects first, so you don't end up with duplicates, but that's up to you.įirst of all, you're not modifying the actual source code of your macros. Run the macro Edit Selected Objects as JSON Text (or Edit Selected Objects as XML Text).īack in the KM editor, use Paste Objects into KM to paste it back into KM. In the KM editor, select one or more actions, macros, or groups. See the macro Open Editor to Edit Object Text for more information. The default text editor is BBEdit, but you can change it to use other text editors. Image 860×489 94.6 KB TEXT EDITORS: Click to expand