ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

xml​2json

by vontio ALL

xml to json and json to xml convert

Details

Installs

  • Total 47K
  • Win 26K
  • Mac 16K
  • Linux 6K
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
Windows 0 0 2 5 2 5 5 0 1 1 4 1 1 1 1 2 0 5 5 2 0 2 0 2 0 3 3 0 1 0 2 1 1 2 2 0 0 3 1 3 5 1 1 1 3 2
Mac 0 0 1 0 2 1 0 1 0 1 3 1 1 0 1 1 0 3 3 1 1 1 1 1 0 1 1 1 1 1 2 2 0 1 1 0 1 1 0 7 1 2 0 0 2 4
Linux 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime xml to json and json to xml

convert xml file to json file or json file to xml file.

Installation:

  • you should use sublime package manager
  • use cmd+shift+P then Package Control: Install Package
  • look for xml2json and install it.
  • OR, Clone or unpack to “xml2json” folder inside “Packages” of your Sublime installation.

Usage :

  • use cmd+shift+P then xml2json or json2xml (opens result in a new unsaved buffer)
  • use cmd+shift+P then xml2json (Save to file) or json2xml (Save to file) to save next to the source file (e.g. abc.xml -> abc.json, abc.json -> abc.xml); if the target exists you will be asked whether to overwrite, and choosing not to overwrite leaves the result in an unsaved buffer
  • use cmd+shift+P then Pretty JSON, Pretty XML, Compact JSON or Compact XML to format the current buffer without saving
  • or goto menubar Tools then xml2json
  • or bind some key in your user key binding:
{
     "keys": ["ctrl+alt+shift+j"],
     "command": "xml2json"
    },
    {
     "keys": ["ctrl+alt+shift+l"],
     "command": "json2xml"
    }

Settings

  • empty_tag_style: how empty tags are written when generating XML. compact (<tag/>, default), spaced (<tag />), expanded (<tag></tag>).
  • pretty_json_indent: indentation size for pretty JSON (default 2).
  • pretty_xml_indent: indentation size for pretty XML (default 2).
  • default_conversion_pretty: whether conversion commands default to pretty (true/"pretty") or compact (false/"compact"); default true.
  • json_ensure_ascii: whether to escape non-ASCII when emitting JSON (default false).
  • json_sort_keys: whether to sort keys when emitting JSON (default false).
  • normalize_attribute_text_pairs: when converting XML to JSON, convert simple attribute/text pairs (e.g., {"@name": "...", "#text": "..."}) into {name: "...", value: "..."} (default true).
  • attribute_text_value_key: key name to store text content when normalize_attribute_text_pairs is enabled (default "value").
  • default_xml_root_name: fallback root element name when wrapping JSON that lacks a single root (default "root").
  • include_xml_declaration: include <?xml version="1.0" encoding="utf-8"?> when converting JSON to XML (default true).
  • line_ending: line endings for generated output: auto (preserve from source), unix (\n), windows (\r\n), mac (\r) (default auto).
  • ensure_final_newline: ensure generated output ends with a newline (default true).
  • trim_trailing_whitespace: trim trailing spaces/tabs on generated lines (default true; removes spaces after commas in pretty JSON).

You can adjust plugin settings and shortcuts via Sublime Text -> Settings -> Package Settings -> xml2json -> Settings and Key Bindings.