Excellent. I don't know why that menu items was disabled, but it works now. Also seems to work OK for the XML files I have. Thank you!
On Friday, November 4, 2022 at 10:47:47 AM UTC-7 jj wrote: > Check out that the "Apply Text Filter" checkbox is activated in the > Settings > Menus & Sortcuts > Text list: > > [image: Screenshot 2022-11-04 at 18.28.00.png] > Check out that the shell script has execute permission. > > [image: Screenshot 2022-11-04 at 18.33.56.png] > > Warning: > The proposed solution "as is" only works for very simple XML. > XML and JSON formats are not homeomorphic, many things can fail : > entities, cdata, element repetitions, attributes, etc. > However, combined with 'jq' there seems to be more powerful > customizations. > For example, see: https://unix.stackexchange.com/a/658021 > > For a Text Factory to batch a folder refer to the BBEdit manual and the > "Run Unix Filter" command. > > HTH, > > Jean Jourdain > On Friday, November 4, 2022 at 5:28:00 PM UTC+1 severdia wrote: > >> I don't see a menu item called "Apply Text Filter". There's "Apply Text >> Transform", but when I open that I don't see the script in dialog that >> opens with that menu. Can you elaborate? Ideally I could process a folder >> of XML files and convert then to JSON. I'm using BBedit 14.6.1. >> >> Thanks! >> >> On Friday, November 4, 2022 at 1:14:32 AM UTC-7 jj wrote: >> >>> You could try yq <https://kislyuk.github.io/yq/>. >>> >>> Install it from Terminal with homebrew <https://brew.sh>: >>> >>> brew install python-yq >>> >>> Create this simple BBEdit text filter in *~/Library/Application\ >>> Support/BBEdit/Text\ Filters/xml2json.sh* >>> >>> #!/bin/sh >>> xq '.' >>> >>> and call the filter from menu Text > Apply Text Filter > xml2json. >>> >>> HTH, >>> >>> Jean Jourdain >>> >>> On Thursday, November 3, 2022 at 1:28:42 AM UTC+1 severdia wrote: >>> >>>> Is there an easy way to so a simple XML to JSON conversion in BBedit? >>>> Oxygen and some other tools seem to do this, but short of creating a >>>> TextFactory or similar, I don't see an easy way to do it. >>>> >>>> -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/686ba666-1fda-4ce8-9874-8a58f737d33en%40googlegroups.com.
