Reformat your json files~

Discussion in 'Mod Discussions' started by shadowmint, June 10, 2013.

  1. mysticalfists

    mysticalfists Member

    Messages:
    92
    Likes Received:
    40
    They're valid. It's giving those errors on any JSON file I've tried (all from pa/units), such as assault_bot.json. Only one I found that worked was radar_adv.json. Will give it another go later.

    EDIT: Just tried again and it seems to be working. Not sure if it was due the folder I was trying to edit them in (AppData, Program x86, etc) or because I needed to restart or whatever. Seems to be working just fine though now!~
    Last edited: December 26, 2015
  2. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Is anyone interested in a pretty printing json parser that has slightly better error reporting?
    [​IMG]
    Points to the problematic area with a handy source preview.
    [​IMG]
    Warns about numbers or extra commas (but tries to parse it anyway).
    [​IMG]
    Finally, you can include comments! Keep in mind that PA does not support comments, so you really should strip them out (the script can do that).
    Last edited: February 1, 2016
    DeathByDenim likes this.
  3. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    I've just started trying out Microsoft Visual Code which will identify issues as you edit the files. Something which spots them prior to saving is probably better than something which can notify you after. Sublime Text does the same I believe.
  4. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Does the Microsoft product do it for json too? If so, pretty nifty. My use case for this parser though is to integrate with some of my other tools. Also, I was bored :p.
  5. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    I spent more time trying to set it up to work with Git than I did using it, but it looked like it did. Certainly it was highlighting (and its highlighting default is better than Notepad++'s), and it noticed a missing comma immediately. Will be playing around with it more tonight.
  6. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    Just to confirm, it will detect errors in JSON in real time. Visual Studio Code is also open source, if that's important to you.
    dom314 likes this.
  7. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    I just checked it out, it's really amazing. Looks like Microsoft is going to have a monopoly on programming software again.

Share This Page