JSON-java icon indicating copy to clipboard operation
JSON-java copied to clipboard

to compact json string

Open batobolg opened this issue 10 years ago • 2 comments

I want json string not every element newline so I change the code JSONObject public Writer write(Writer writer, int indentFactor, int indent) method. just add

            int coutline = 0;
            while (keys.hasNext()) {
                Object key = keys.next();
                if (commanate) {
                    writer.write(',');
                }
                if (indentFactor > 0 && coutline%4 == 0) {
                    writer.write('\n');
                    indent(writer, newindent);
                }
                //indent(writer, newindent);
                writer.write(quote(key.toString()));

it so works.

batobolg avatar Oct 08 '16 09:10 batobolg

4 element maybe make it property is good.

batobolg avatar Oct 08 '16 09:10 batobolg

Thanks, but not at this time.

stleary avatar Oct 15 '16 15:10 stleary