mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 07:22:39 +00:00
support json serialization
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
namespace NamespaceA.NamespaceB
|
||||
{
|
||||
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
#endif
|
||||
public enum EnumInNestedNS : sbyte
|
||||
{
|
||||
A = 0,
|
||||
|
||||
@@ -47,7 +47,13 @@ public struct StructInNestedNS : IFlatbufferObject
|
||||
|
||||
public class StructInNestedNST
|
||||
{
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("a")]
|
||||
#endif
|
||||
public int A { get; set; }
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("b")]
|
||||
#endif
|
||||
public int B { get; set; }
|
||||
|
||||
public StructInNestedNST() {
|
||||
|
||||
@@ -53,6 +53,9 @@ public struct TableInNestedNS : IFlatbufferObject
|
||||
|
||||
public class TableInNestedNST
|
||||
{
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("foo")]
|
||||
#endif
|
||||
public int Foo { get; set; }
|
||||
|
||||
public TableInNestedNST() {
|
||||
|
||||
@@ -53,6 +53,9 @@ public struct SecondTableInA : IFlatbufferObject
|
||||
|
||||
public class SecondTableInAT
|
||||
{
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("refer_to_c")]
|
||||
#endif
|
||||
public NamespaceC.TableInCT ReferToC { get; set; }
|
||||
|
||||
public SecondTableInAT() {
|
||||
|
||||
@@ -55,8 +55,17 @@ public struct TableInFirstNS : IFlatbufferObject
|
||||
|
||||
public class TableInFirstNST
|
||||
{
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("foo_table")]
|
||||
#endif
|
||||
public NamespaceA.NamespaceB.TableInNestedNST FooTable { get; set; }
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("foo_enum")]
|
||||
#endif
|
||||
public NamespaceA.NamespaceB.EnumInNestedNS FooEnum { get; set; }
|
||||
#if ENABLE_JSON_SERIALIZATION
|
||||
[Newtonsoft.Json.JsonProperty("foo_struct")]
|
||||
#endif
|
||||
public NamespaceA.NamespaceB.StructInNestedNST FooStruct { get; set; }
|
||||
|
||||
public TableInFirstNST() {
|
||||
|
||||
Reference in New Issue
Block a user