Python-GVAS-JSON-Converter (SavConverter) is a library designed to convert Unreal Engine's Game Variable and Attribute System (GVAS) files between .sav and .json formats.
Project description
Python-GVAS-JSON-Converter
Python-GVAS-JSON-Converter (SavConverter) is a library designed to convert Unreal Engine's Game Variable and Attribute System (GVAS) files between .sav and .json formats. It provides a way to read and interpret the binary structure of .sav files and translate them into human-readable JSON format, as well as convert JSON back to the original .sav format.
Features
- Convert from .sav to .json: Supports converting Unreal Engine's
.savfiles into.jsonformat. - Convert from .json to .sav: Includes the ability to convert
.jsonfiles back to the original.savformat. - JSON Editing Functions: Offers a range of functions to navigate, manipulate, and modify the specific JSON structure with ease.
- Tested Games: The conversion has been tested with the following games (and may work for others):
Crab ChampionsDeep Rock GalacticHigh On LifeHogwarts LegacyStray
- Actively Developed: This project is actively being developed, with new features and improvements being added.
Warning
- Untested .sav Files: Some classes in SavProperties.py may not function correctly with untested
.savfiles, and certain SavReader.py code segments may be broken for untested datatypes. While the library has been designed with flexibility in mind, full compatibility with all.savfiles cannot be guaranteed at this stage. Efforts will continue to progressively test other games'.savfiles and refine the code accordingly.
Using the Conversion Functions
The conversion functions provide an easy way to translate between Unreal Engine's .sav and .json formats.
Converting from .sav to .json
- Read .sav: Use
read_sav(file_path)to get the property instances from the.savfile. - Convert to JSON: Use
sav_to_json(props, string=True)to convert properties to JSON. Use thestringparameter to return a JSON string or object. - Write to File: Write the JSON string output to a
.jsonfile.
Converting from .json to .sav
- Load JSON: Use
load_json(file_path)to read a JSON file. - Convert to Binary: Use
json_to_sav(json_string)to convert JSON to binary data. - Write to File: Write the binary data to a
.savfile.
Using JSON Editing Functions
The JSON editing functions allow users to navigate and manipulate the JSON structure using paths, providing functions like:
Finding Objects
get_object_by_path(data, path): Locate objects in JSON by specifying the path. Returns the object found at the specified path orNoneif the path is not found.
Inserting Objects
insert_object_by_path(data, path, new_object, position='after'): Add a new object at the specified location. Use thepositionparameter to insert before or after the targeted object.
Replacing Objects
replace_object_by_path(data, path, new_object): Replace an object at the specified path with a new object.
Updating Properties
update_property_by_path(data, path, new_value): Modify specific keys within an object at the given full path to the property.
Loading JSON
load_json(file_path): Load a JSON file from the specified file path.
Converting Object to JSON String
obj_to_json(obj): Convert an object into a JSON string with proper indentation.
Printing JSON
print_json(data): Print a JSON object with indentation for better readability.
Understanding the Path Structure
path: A list that describes the path to the object you're looking for. Each element in the list can be:- A dictionary, to match a specific key-value pair.
- A string, to reference a key.
- An integer, to reference an index in a list.
Example path:
path_to_find = [{"name": "RankedWeapons"}, "value", 0, {'name': 'Rank'}, 'value']
Let's break down the example path:
{"name": "RankedWeapons"}: Look for an object with a key"name"and a value"RankedWeapons"."value": Inside the found object, look for the key"value".0: Inside the value, look for the first element in the list (index0).{'name':'Rank'}: Look for an object within that element with a key"name"and a value"Rank"."value": Inside the found object, look for the key"value".
This path leads you directly to a specific part of the JSON structure
Example Code
A comprehensive usage example for all the available functions is provided in the Example.py file. This example was developed using the Crab Champions .sav and .json files, which you can find in the ExampleSavFiles directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SavConverter-0.1.1.tar.gz.
File metadata
- Download URL: SavConverter-0.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a364644492d221539747a4efa0e9eb4d4e2eadde4fb46f6b824bcb03cfdc7f19
|
|
| MD5 |
81b911af8adb0e0b8518ac42905c99d6
|
|
| BLAKE2b-256 |
89b7ea19ce3e877bf4ca17f9795940ffb8019c90fd790b87901df0a27273ffb8
|
File details
Details for the file SavConverter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: SavConverter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc0580d9ef6ac103069d078e8c081532a88e6dd2ad46b3d5c3be96181168b63
|
|
| MD5 |
cd56165d869dc470b91702fb1c4c474f
|
|
| BLAKE2b-256 |
e457d8edc8d9c4082e760b14a176ed0fedee0f777e62c11227d2aeaed939bc07
|