GithubHelp home page GithubHelp logo

Comments (5)

fkei avatar fkei commented on June 28, 2024

I tried to minify this json.

Use below code.

// foo.js
var fs = require("fs");
var jsonminify = require("jsonminify");
var raw = fs.readFileSync('/tmp/11240696/gistfile1.txt', 'utf-8');

var out = jsonminify(raw);

console.log("---------");
console.log(out)
console.log("---------");

But output has no whitespece.

$ node foo.js
---------
{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup"}}}}}
---------

I have no idea why your output has whitespace.

from json.minify.

tomByrer avatar tomByrer commented on June 28, 2024

I have no idea why your output has whitespace.

Perhaps they are tabs, hard-space, or other whitespace that the RegEx doesn't check?
No way to check without seeing the source files inside a .ZIP or 7z archive @syst3mw0rm

from json.minify.

syst3mw0rm avatar syst3mw0rm commented on June 28, 2024

ok, I've uploaded relevant source code here - https://dl.dropboxusercontent.com/u/9555782/json-minify.zip

Code is bit involved than just json minification and it is quite possible that the bug is not in json minify itself but some other piece of code. Code is pretty straightforward to understand and see what's going on. I'm still unable to figure out from where does mysterious trailing whitespaces appear. Help is much appreciated.

from json.minify.

fkei avatar fkei commented on June 28, 2024

I can get reproduce the bug, but the cause is unknown.

It works correctly with text format (ex: #8 (comment)), so I think server is the cause of this bug.

I'll close this issue, but if you can reproduce the bug with text format(not binary format), give me the code and reopen this issue plase.

from json.minify.

syst3mw0rm avatar syst3mw0rm commented on June 28, 2024

Yeah, not a problem. Probably this ain't issue with json-minify anyway.

But, What do you by reproducing it in text format and giving you the code? I think I already did that.

from json.minify.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.