• 中文
  • Json.cs中是否存在问题

  • Изменено
Related Discussions
...

您好,我想使用 spine 运行库中的 spine-runtimes/spine-csharp/src/Json.cs 中的 Decode 方法解析 Json 对象,
其中长度过长的字符串值会被截断,请问是否是 ParseString 方法出现了问题
当 builder != null 时,是否应该在 return builder.ToString (); 前再调用一次 builder.Append(stringBuffer, 0, idx);

恐怕机器翻译无法正确翻译您的消息。 您能否在您认为缺少或出错的地方添加评论并分享一些代码? 我只是看到对这行代码的引用,但不太明白 您认为处理不当。

如果您可以共享一些显示如何重现您遇到的问题的代码,这也会有所帮助。


I'm afraid machine translation failed to translate your message properly. Could you please share some code with added comments where you think something is missing or going wrong? I just see a reference to this line of code, but don't quite understand what you think is incorrectly handled.

It would also help if you could share some code that shows how to reproduce the problem you are encountering.

当我使用如下的代码时,其中\"……a very long string\" 表示它是一个非常长的一个字符串(超过6000个字符)

json = "{ \"key\" : \"……a very long string\",}";
var parse = new SharpJson.JsonDecoder();
Dictionary<string,object> dict = parse.Decode(json) as Dictionary<string,object>; 
Debug.Log(jsonTest["key"]);

最后输出的字符串 jsonTest["key"] 会丢失后面的一部分,例如"a very long string"会丢失,我猜测是ParseString()方法存在一些问题导致的。

我尝试用英文描述一下,我的英文不太好所以有些不太好意思。

When I use code above, \"……a very long string\" means it is a very long string (more than 6000 characters).

The latter part of string jsonTest["key"] will be lost, for example "a very long string" will be lost, I think that it is caused by method ParseString().

感谢您的澄清。 为什么在骨架 json 文件中有超过 6000 个字符的字符串? 这听起来像是您的设置有问题。
Thanks for the clarification. Why are you having strings in a skeleton json file that have more than 6000 characters? This sounds like something is wrong with your setup.

我的设置应该确实有一些问题,感谢您的回复。

别客气。 如果您从最新版本的 Spine 编辑器中导出了这个框架 .json 文件并且没有修改它,请随时与我们分享它,以便我们可以看看那里出了什么问题。
You're welcome. If you exported this skeleton .json file from the latest version of the Spine Editor and did not modify it, feel free to share it with us so that we can have a look at what's going wrong there.