About:
I have added an open source project to the GitHub. The project, ReformatCode currently only supports reformatting JSON data to human readable format. Though I hope in the future it can be extended to support CSS indentation structuring with intelligent parent – child relationship styles. Formatting CSS can be a little complex if you want it to really show properly how the CSS works with other classes and what is a sub element or sub class of another. So that would be a possible and welcome addition to the code base in the future if effort is put into it.
Download:
ReformatCode Project via GitHub
Usage:
Passing either a JSON object or string, will reformat the JSON to a human readable level.
Second param (optional) is an object of settings to override defaults.
Example:
ReformatCode.formatJSON({"key": {"sub_key": "sub_value"}}, {"indent": "spaces", "debug": true, "newline": "\r"});
Input:
{"key": {"sub_key": "sub_value"}Ouput:
{
"key": {
"sub_key": "sub_value"
}
}