Skip to content

chore(legacy JSON): migrate all 8 files from JSON.new().parse() to JSON.parse_string() #247

@niyazmft

Description

@niyazmft

Summary

Eight .gd files use the legacy Godot 3.x pattern JSON.new().parse(text) instead of the Godot 4.x idiomatic JSON.parse_string(text). This is inconsistent with scripts/autoload/config_loader.gd:139 which already uses the modern pattern.

Files Affected

File Lines
scripts/combat/room_loader.gd 29-30
scripts/core/encounter_system.gd 55-56
scripts/core/loot_table.gd 29-30
scripts/core/room_generator.gd 86-87
scripts/autoload/settings_manager.gd 75-76
scripts/autoload/grid_system.gd 166-167
scripts/autoload/save_manager.gd 131-132
scripts/entities/apparition_renderer.gd 124-125

Suggested Fix

Replace:

var json := JSON.new()
var err := json.parse(text)
if err != OK:
    push_error("...")
    return {}
return json.data

With:

var data: Variant = JSON.parse_string(text)
if data == null or not data is Dictionary:
    push_error("...")
    return {}
return data

Priority: P1 · Size: S (was XS — expanded from 1 file to 8) · Status: Ready

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjulesGating label for Google Jules offload

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions