Code Monkey home page Code Monkey logo

Comments (3)

ousttrue avatar ousttrue commented on May 19, 2024 1

f.Key("field_name"); f.Value(field_name); というようにペアで使ってください。
key value key valueの順番で来ることをチェックしていて違反したとき(key value valueなど)にJsonFormatException: key exptectedが出ます。

from univrm.

ousttrue avatar ousttrue commented on May 19, 2024

JsonにSerializeするときに使っています。

        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            f.KeyValue(() => name); // これを実装するのに使っている
         }

下記の記法に置換すれば、KeyValue関数を削除できると思います。

            f.Key("name"); f.Value(name); // これと同じ意味

from univrm.

kamanii24 avatar kamanii24 commented on May 19, 2024

ありがとうございます!
KeyValueに当たる部分全て置換して、一部gltfクラスの変数にはGLTFValue()を設定しました。
上記対応して実行したところ、JsonFormatException: key not exptected エラーで止まってしまったのですがこの場合のエラーの原因はわかりますか?
誤字かと思い見直してみましたが、そうではなさそうでした。

エラー全文です

JsonFormatException: key exptected
UniJSON.JsonFormatter.CommaCheck (Boolean isKey) (at Assets/VRM/UniGLTF/UniJSON/Scripts/JsonFormatter.cs:121)
UniJSON.JsonFormatter.Value (Int32 x) (at Assets/VRM/UniGLTF/UniJSON/Scripts/JsonFormatter.cs:254)
UniGLTF.glTFAttributes.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:56)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.glTFPrimitives.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:127)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.GLTFJsonFormatter.GLTFValue[glTFPrimitives] (IEnumerable`1 values) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:21)
UniGLTF.glTFMesh.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTFMesh.cs:174)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.GLTFJsonFormatter.GLTFValue (UniGLTF.JsonSerializableBase s) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:13)
UniGLTF.GLTFJsonFormatter.GLTFValue[glTFMesh] (IEnumerable`1 values) (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonFormatter.cs:21)
UniGLTF.glTF.SerializeMembers (UniGLTF.GLTFJsonFormatter f) (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTF.cs:347)
UniGLTF.JsonSerializableBase.ToJson () (at Assets/VRM/UniGLTF/Core/Scripts/Format/JsonSerializableBase.cs:16)
UniGLTF.glTF.ToGlbBytes () (at Assets/VRM/UniGLTF/Core/Scripts/Format/glTF.cs:397)

from univrm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.