# Protojson marshaler wrong field type in nested message

**URL:** <https://forum.heroiclabs.com/t/protojson-marshaler-wrong-field-type-in-nested-message/2358>\
**Category:** Runtime Framework\
**Created:** [February 12, 2022, 12:27pm UTC](https://forum.heroiclabs.com/t/protojson-marshaler-wrong-field-type-in-nested-message/2358 "2022-02-12T12:27:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [February 12, 2022, 12:27pm UTC](https://forum.heroiclabs.com/t/protojson-marshaler-wrong-field-type-in-nested-message/2358/1 "2022-02-12T12:27:14Z")

</div>

Hi guys,

Please look at my message declaration. I have Avatar and NetworkEntityState message

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/1X/ddcec351d1cf97812bcbbdf17af2dbde074b5bf8.png)

When player join a match, i load Avatar from StorageEngine and send to client in a NetworkEntityState message. This is jsonValue of avatar  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/3/325a3f17652b5cf9c26925e56a23aa35d3ed50f1.png)

But in the log of Unity, the field type of object Avatar was changed from number to string. So an exception was threw

```auto
MatchStateJson [{"states":[{"id":"72a21b7a-380c-4b23-9ac6-abe12b4c5573", "username":"GSzGbaQbJB", "yPos":1, "state":"1", "avatar":{"hair":"6"}}]}]

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/a/ae3070825da0ac57589302e31d7c7d36ed6c07fd.png)

Please help me to explain this issue.

---

<div class="post-metadata">

**Author:** ![mharis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mharis/32/969_2.png) [@mharis](https://forum.heroiclabs.com/u/mharis)\
**Post date:** [February 13, 2022, 10:11pm UTC](https://forum.heroiclabs.com/t/protojson-marshaler-wrong-field-type-in-nested-message/2358/2 "2022-02-13T22:11:35Z")

</div>

It looks like int64 types are treated as strings by the specific marshaler you are using.

---

<div class="post-metadata">

**Author:** ![tunglt1810](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tunglt1810/32/924_2.png) [@tunglt1810](https://forum.heroiclabs.com/u/tunglt1810)\
**Post date:** [February 15, 2022, 4:26pm UTC](https://forum.heroiclabs.com/t/protojson-marshaler-wrong-field-type-in-nested-message/2358/3 "2022-02-15T16:26:18Z")

</div>

I found it. I followed template project and used protojson to encode and decode message.  
I also changed it to proto, and now it’s worked.
