Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Resource2JSON

An asset by maxiking445
The page banner background of a mountain and forest
Resource2JSON hero image

Quick Information

0 ratings
Resource2JSON icon image
maxiking445
Resource2JSON

ResourceJSON is a lightweight Godot addon for converting Resources to JSON and restoring them from JSON. Its goal is to make Resources easier to store, exchange, inspect, and process.Installation and usageSee: https://github.com/maxiking445/godot-resource-json/blob/main/README.md

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
17 hours ago
Git URL
Issue URL

ResourceJSON

ResourceJSON icon

License Latest Release

ResourceJSON is a lightweight Godot addon for converting Resources to JSON and restoring them from JSON. Its goal is to make Resources easier to store, exchange, inspect, and process.

Installation and usage

Copy the addons/jsonConverter/ directory into the addons/ directory of your Godot project. JsonConverter.gd declares the global class JSONConverter, so you can use it from any GDScript without creating an instance or configuring an autoload.

Convert a Resource to a JSON string:

var resource := preload("res://my_resource.tres")
var json := JSONConverter.stringify(resource)

# Optionally use spaces instead of the default tab indentation.
var formatted_json := JSONConverter.stringify(resource, "  ")

Restore a Resource from JSON:

var resource: Resource = JSONConverter.parse(json)
if resource == null:
    push_error("The JSON could not be converted to a Resource.")

The generic convert() method chooses the direction based on its argument:

var json: String = JSONConverter.convert(resource)
var restored_resource: Resource = JSONConverter.convert(json)

If you do not want to use the global class name, preload the script explicitly:

const JsonConverter := preload("res://addons/jsonConverter/JsonConverter.gd")

var json := JsonConverter.stringify(resource)
var restored_resource := JsonConverter.parse(json)

All public methods are static, so JSONConverter.new() is not required. The aliases resource_to_json() and json_to_resource() are also available if you prefer more explicit method names.

Development setup

The test dependency GUT is not committed to this repository and is not part of the distributed addon. Install it locally with:

./install_GUT.sh

The script installs GUT into addons/gut/. This directory is ignored by Git. By default, the branch compatible with Godot 4.7 is used. To install a specific GUT tag or commit instead, set GUT_REF, for example:

GUT_REF=v9.6.0 ./install_GUT.sh

This command installs GUT and then runs all configured tests. The installation logic is included directly in the root-level install_GUT.sh script, so no installer file is kept inside addons/gut/.

ResourceJSON is a lightweight Godot addon for converting Resources to JSON and restoring them from JSON. Its goal is to make Resources easier to store, exchange, inspect, and process.

Installation and usage
See: https://github.com/maxiking445/godot-resource-json/blob/main/README.md

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Resource2JSON icon image
maxiking445
Resource2JSON

ResourceJSON is a lightweight Godot addon for converting Resources to JSON and restoring them from JSON. Its goal is to make Resources easier to store, exchange, inspect, and process.Installation and usageSee: https://github.com/maxiking445/godot-resource-json/blob/main/README.md

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
17 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers