所以基本上我得到了格式错误的JSON:
'status': {'$content': 'Completed'}
'status': 'Completed'
<;-期望
'foobar': {'$content': 1}
'foobar': 1
<;-期望
我试图(([^{'\$content':]))
与{'$content':
不匹配,因为这总是没有用的
但是,我不知道如何让第二个组实际匹配正确的值,并去掉最后一个}
"SkillTreeModel":{"idToLevelDict2.0":{"TapDmg":2,"TapDmgFromHelpers":1,"PetDmg":0,"PetGoldQTE":13,"HeavyStrikes":16,"FireTapSkillBoost":0,"PetQTE":0,"Frenzy":0,"BossDmgQTE":0,"AllHelperDmg":15,"ChestGold":1,"HelperDmgSkillBoost":16,"ClanShipDmg":15,"HelperBoost":14,"HelperInspiredWeaken":1,"ClanQTE":16,"HelperDmgQTE":12,"ClanShipStun":0,"MPCapacityBoost":0,"MidasSkillBoost":0,"BurstSkillBoost":0,"CloneDmg":0,"Fairy":0,"ManaStealSkillBoost":0,"CloneSkillBoost":0,"ManaMonster":0,"CritSkillBoost":0,"BossTimer":0,"OfflineGold":11,"MultiMonsters":1,"CritSkillBoostDmg":3,"UltraDagger":1,"StrokeOfLuck":6,"SoulBlade":0,"Cloaking":1,"ForbiddenContract":0,"PoisonedBlade":0,"GuidedBlade":13,"None":0},"firstTimeSeeNewSkillTree":{"$content":true},"hasResetTreeThisPrestige":{"$content":false}}
如果有一种Python式的方式,我也会心存感激
您可以使用} 检查包含
object_hook
到^{$content
键的字典,并将其替换为值。请注意,您的JSON
缺少包含{}
的内容,因此您需要添加它们:输出:
它仍然是一个有效的json,所以您可以转换为字典并根据需要更新键值
例:
假设您想从
SkillTreeModel.hasResetTreeThisPrestige.content: False
更新 到SkillTreeModel.hasResetTreeThisPrestige: False
相关问题 更多 >
编程相关推荐