Recent minifying of JSON ruined my work

Romarain

New Member
Hello,
Since two weeks, I was developping a program to convert scenes collection from a format (ex: 1080p) to another (ex : 720p).
Knowing no standalone language other than MS-DOS, I started coding with it.
I was almost at 90% of my work when suddently (today), I realized that my program wasn't working anymore : and I found that it was because you decided to MINIFY your JSON files -_-

Parsing a file in MSDOS is possible (using the FOR command amongst a few), but parsing a single line is hell.

So, guys, can you help me and give me a link to a program or a command I could implement in my work to unminify JSONs ?

I was planning to release it online, it's a serious project. There's a ton of lines and hard work, why to minify JSON when we only load one JSON at a time in OBS ? Minifying is useful for website and JS, not for a software that doesn't plan to display a page the quicker it can.
 
Last edited:

Romarain

New Member
An option in OBS to enable/disable minifying of the JSON files would be the easiest solution (so people can decide if they want to "accelerate" scenes collections loading, if that is really noticeable).
 

dodgepong

Administrator
Forum Admin
If you use a proper JSON parser instead of trying to parse JSON manually using some sort of weird MSDOS jank, this would be relatively straightforward and unaffected by minification.
 

Romarain

New Member
I don't understand you answer : I'm using MS DOS as a programming language, to make a program. This program does many things, like reading a file, evaluating its number of lines, calculating how it could process the next operations in several batches at the same time, open the file again with all the batches launched wich individually read a portion of the JSON, and then detect some peculiar parts of lines, and modify them (wich in itself requires some special and distinct operations). This is called a program, that program relies on reading files containing several lines : now that JSONs are minified, there is a single line, and to detect things in that line I have to parse it (when I didn't have to before). Not mentioning that the line is HUGE and MS-DOS limits variables to ~8190 characters, so I can't even process the line.

How the hell can you come and just say "don't use MS DOS to parse JSON" ? That wasn't the topic. I don't want to parse JSON, I never had too before the recent JSON minifying decided by the dev team. Now if you know a JSON parser that can be used in Windows as a .EXE and called by MS-DOS batches, feel free to say it.

But I'm pretty sure you can't, because this is a technology used by webdevs and mainly proposed as online services where you can copy your code and obtain the minified result in the page, or JS scripts that can be implemented in web projects. After half an hour of web search, I only found a python minifier (not un-minifier), and nothing that can be use as a stand-alone that could permit a user to use my batch without installing weird developers language on his machine. JSON minifying is useless if not used in a website or database context.
 
Last edited:

R1CH

Forum Admin
Developer
JSON is meant to be read by a JSON parser, not random DOS-era command line functions. It does not matter what form the JSON is in if you use a JSON parser. Trying to parse JSON without a JSON parser is like scraping HTML from a website instead of using an API - you don't get to complain when it breaks.
 
Romarain: if you want to continue on your current approach, there are many tools that can convert minified json to "prettified" json, with the newlines and indenting that you are looking for.

The simplest is probably to download and install Python. Then you can do something like
python -m json.tool your_squished_file.json > your_pretty_file.json
Then you can process your_pretty_file as you have in the past. OBS will load the "pretty" version just fine.

I would also encourage you to start to learn Python. If you have figured out how to process json using batch-file, you are certainly clever enough to learn Python, and give yourself a powerful set of new tools. There are many tutorial and other learning resources on the web. You don't have to learn it all at once - just figure out features as you need them.
 

Romarain

New Member
The problem of Python is I can't make a program with it : I mean a program the user can use by clicking on it.
For the same reason, if I continue my work with MS-DOS, I want t solution that DOESNT IMPLY to install Python for the users.

So, I need something to include in my MS-DOS program that can unminify JSON on the go, for my users to have nothing to install.
Do you understand guys that I'm making a program intended to be distributed on the web, and wich can convert OBS scenes ? I will give it and people will click on the BAT file. So I don't want them to install anything, they are not devs !

JSON is meant to be read by a JSON parser, not random DOS-era command line functions.
You didn't understand what I'm asking, you answered too quickly. I never said I had to parse JSON. Now that it is minified, I had to unminify it, that's all. I don't want to throw my MSDOS work in the trashbin, I just know that language. I don't want lessons about not knowing other languages, I just want you to respect my work and do an effort.
 

dodgepong

Administrator
Forum Admin
There are packages for creating executables for Python scripts, such as cx_freeze.

Also, you literally said you needed to parse a JSON file in your first post. I respect that you have put work into this batch file but it's foundation is faulty from the outset. You can't and shouldn't use string parsing to parse JSON. You need to use a JSON parser.
 
Top