You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

星露谷物语Tokipona本地化JSON文件语法错误求助

问题分析

你的JSON语法错误核心在于Content字段的结构违规:

  • 原代码里Content被定义为数组([]),但数组内部却使用了键值对格式("Tokipona_Tokipona": {...})。JSON规则明确:数组只能包含值(对象、字符串、数字等),不能容纳带键的条目,这直接导致了解析时的语法报错。
修正方案

结合星露谷Mod语言文件的规范,提供两种可行的修正方式:

方式1:Content为数组(匹配ListReader的预期)

移除数组内的键名"Tokipona_Tokipona",直接将语言配置对象放入数组:

{
    "header": {
        "target": "w",
        "formatVersion": 5,
        "hidef": true,
        "compressed": 128
    },
    "readers": [
        {
            "type": "Microsoft.Xna.Framework.Content.ListReader`1[[StardewValley.GameData.ModLanguage, StardewValley.GameData, Version=1.6.8.24119, Culture=neutral, PublicKeyToken=null]]",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[StardewValley.GameData.ModLanguage, StardewValley.GameData, Version=1.6.8.24119, Culture=neutral, PublicKeyToken=null]]",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.StringReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.BooleanReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.SingleReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.Int32Reader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]",
            "version": 0
        }
    ],
    "Content": [
        {
            "ID": "tokipona_tokipona",
            "LanguageCode": "tp",
            "ButtonTexture": "Content/LooseSprites/LanguageButton.tp-MP.xnb",
            "UseLatinFont": false,
            "TimeFormat": "[HOURS_24_00]:[MINUTES]",
            "ClockTimeFormat": "[HOURS_24_00]:[MINUTES]",
            "ClockDateFormat": "󱥤[DAY_OF_WEEK]/󱥤[DAY_OF_MONTH]",
            "FontFile": "Content/Fonts/sitelenpona.fnt",
            "FontPixelZoom": 1.5
        }
    ]
}

方式2:Content为对象(若配置允许)

将Content的数组符号[]改为对象符号{},保留原键名:

{
    "header": {
        "target": "w",
        "formatVersion": 5,
        "hidef": true,
        "compressed": 128
    },
    "readers": [
        {
            "type": "Microsoft.Xna.Framework.Content.ListReader`1[[StardewValley.GameData.ModLanguage, StardewValley.GameData, Version=1.6.8.24119, Culture=neutral, PublicKeyToken=null]]",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[StardewValley.GameData.ModLanguage, StardewValley.GameData, Version=1.6.8.24119, Culture=neutral, PublicKeyToken=null]]",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.StringReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.BooleanReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.SingleReader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.Int32Reader",
            "version": 0
        },
        {
            "type": "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]",
            "version": 0
        }
    ],
    "Content": {
        "Tokipona_Tokipona": {
            "ID": "tokipona_tokipona",
            "LanguageCode": "tp",
            "ButtonTexture": "Content/LooseSprites/LanguageButton.tp-MP.xnb",
            "UseLatinFont": false,
            "TimeFormat": "[HOURS_24_00]:[MINUTES]",
            "ClockTimeFormat": "[HOURS_24_00]:[MINUTES]",
            "ClockDateFormat": "󱥤[DAY_OF_WEEK]/󱥤[DAY_OF_MONTH]",
            "FontFile": "Content/Fonts/sitelenpona.fnt",
            "FontPixelZoom": 1.5
        }
    }
}
验证步骤

修正后可以通过浏览器控制台执行JSON.parse(你的JSON字符串)检查语法合法性,确认无报错后再使用xnbcli工具进行转换。

内容的提问来源于stack exchange,提问作者Yudgedelighted

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 05:44:52