Json Import and Export - Synthlight/MHW-Editor GitHub Wiki

Table of Contents

Saving & Loading as Json

Whenever you make any changes, these changes are tracked, so long as the file is still open. Loading/opening any file (even the same one) will clear those tracked changes.

You can use the Save Changes as JSON button to save the changes you made to a json file. SAVING THE FILE, OR JSON, DOES NOT CLEAR THE TRACKED CHANGES. You can also save/merge the json with an existing json file.

Loading a json files loads the changes as UNSAVED, tracked changes. Press the normal save button to save them.

This system is designed to be safe to use between game update versions. The goal is you can quickly re-extract the newer files from a newer chunk and reapply the same changes to the same rows.

A json file looks like this:

{
  "targetFile": "armor.am_dat",
  "version": 3,
  "changesV3": {
    "Entries": {
      "9|Low_Rank|Regular|Head": {
        "Fire_Res": 10
      },
      "4|Low_Rank|Regular|Head": {
        "Water_Res": 10,
        "Is_Permanent_Raw": 1
      },
      "10|Low_Rank|Regular|Head": {
        "Set_Skill_1": 4,
        "Ice_Res": 10,
        "Gender": 1,
        "Is_Permanent_Raw": 1
      },
      "11|Low_Rank|Regular|Head": {
        "Thunder_Res": 10
      },
      "13|Low_Rank|Regular|Head": {
        "Dragon_Res": 10
      },
      "12|Low_Rank|Regular|Head": {
        "Fire_Res": 5,
        "Water_Res": 5,
        "Ice_Res": 5,
        "Thunder_Res": 5,
        "Dragon_Res": 5
      }
    }
  }
}

This, when loaded, makes a few simple changes to some specific armors. There are a few fields used as the ID for armor since it has no distinct unchanging ID. Each struct also has a comment indicating which fields are used for the ID.

Entries is the target struct we're changing. This differs per file, but is left as "Entries" for 90% of the files with one repeating struct. This is mostly used to support complex files like .col, pl params, & wp params. If the struct can't be found, it's simply ignored. Wildcards aren't supported for struct names here. If you need this, open an issue.

4|Low_Rank|Regular|Head is an example of ID for armor. If a target ID (row) isn't found, it'll simply be ignored on load. Inside the ID entry, it's just a list of "column ID" : "value".

Wildcards

Wildcards are supported top match either the whole row ID, or a segment of it. This is currently the only form of batch editing you'll find.

You can set * as any row ID and it will apply to all rows. You cal also set parts of the ID as wildcards: 4|Low_Rank|*|Head. (Or even *|*|*|*, which is functionally equivalent to just *.) Note that when doing the partial wildcard, you must have the SAME number of |! You cannot do: 4|Low*lar|Head or: 4|Low*Rank|Regular|Head. Either the whole thing is * or individual sections are. It will not work as a partial match within a word.

Wildcard examples:

{
  "targetFile": "weapon.eq_cus",
  "version": 3,
  "changesV3": {
    "Entries": {
      "*": {
        "Mat_1_Count": 1
      },
      "13|*|Regular|Head": {
        "Dragon_Res": 10
      }
    }
  }
}

Wildcard matches will be used as a fallback if no direct matches are found. This mean you can mix targeted IDs for specific rows, and a wildcard for any unmatched row.

If multiple matches are found for a single row both will be applied in ascending order.

Converting an Old File to Json

Basically, you load the base file, then the 'modded' file on top. So the second file loaded becomes tracked changes which you can then export as json. In order for this to work:

  • YOU MUST USE THE UNMODDED BASE FILE TO START WITH!
  • The base file must be from the SAME CHUNK that the modded file is based off of.

To use it just:

  • Open the unmodded base file.
  • Now, click "Convert file to JSON Changes", and select the modded file.
  • That's it. Now the changes made in that file are tracked changes in the edit, as if you made the edits yourself. Now you can export as json, or make more edits or whatever.

Example: File A: The unmodded file from G4. File B: The modded file from G4 you don't have json for. File C: The unmodded file from G5.

  • Open file A.
    • Select convet to json, pick file B.
    • Export to json.
  • Open file C.
    • Import json.
    • Save and do whatever you want.