C4K3 / nbted

Command-line NBT editor
Creative Commons Zero v1.0 Universal
103 stars 8 forks source link

Add JSON output format #6

Closed WHSMinecraft closed 3 years ago

WHSMinecraft commented 3 years ago

Hi, I came across this great tool because I wanted to get some highscores from the scoreboard.dat file and needed a CLI nbt parser :) But unfortunatly it was some extra work to parse the text format.

That's why I wrote this patch to add a structured output format to nbted. This should make it much easier to compose nbted with other programs in a pipeline.

One thing I intentionally left out however, was JSON parsing (for --reverse and --edit). This is because JSON has fewer datatypes (for example ByteArray, IntArray and LongArray all map to a list). One could infer the types from the elements, but still, it is likely that types would change when doing nbted -p | nbted -r. That is why JSON is simply an output format for now.

This is my first time working with rust, so any comments are appreciated 😉

WHSMinecraft commented 3 years ago

Closed because this does not fit to nbted, which is strictly a nbt editor. For dumping nbt data to json, I found this: https://github.com/PrismarineJS/prismarine-nbt