Nullable will work fine. You just need to be mindful when working with nullable objects to read the HasValue and Value properties to avoid null reference exceptions.
> On Jun 3, 2014, at 8:20 AM, "Joseph Fradley" <[email protected]> wrote: > > Ok, I realize that JSON output from a library not Thrift will not be able > to be read with Thrift. I'll have to use the same technology to read it as > I wrote it. > > I used .NETs JavaScriptSerializer and it worked fine. However, I realized > it included the isset inner structure, which I didn't want. So, I added the > compiler command to include the 'nullable' arg. This removed the _isset but > then I noticed it was including all the member that were null, which I > didn't want. JavaScriptSerializer didn't really have an option to rememdy > this without creating some custom code. So, I went to use JSON.net and it > had all the options I needed. > > Thanks for the feedback Craig. > > Am I losing anything by using the 'nullable' flag and therefore not having > the _isset member? > > > > On Tue, Jun 3, 2014 at 9:36 AM, Craig Peterson <[email protected]> > wrote: > >> You are certainly welcome to serialize the generated objects with json.net >> or whatever. It will work. It will be readable, but it will not work with a >> TProcessor unless you implement TProtocol, which probably would not be >> possible with the straight json representation. If you just want to >> serialize a config file with a known type though, knock yourself out. >> >>>> On Jun 3, 2014, at 6:46 AM, "Joseph Fradley" <[email protected]> >>> wrote: >>> >>> For this portion I'm using C#. So, you're say just use built-in .NET >>> features (not Thrift) to export/import to and from JSON? >>> >>> I could give that a shot. >>> >>> >>> On Tue, Jun 3, 2014 at 8:32 AM, Craig Peterson <[email protected]> >>> wrote: >>> >>>> What language are you using? Some languages have a simple json protocol >>>> that does just that. You could probably look at that and port it if you >>>> really wanted. >>>> >>>>>> On Jun 3, 2014, at 6:23 AM, "Joseph Fradley" <[email protected] >>> >>>>> wrote: >>>>> >>>>> Looking at the JSON output for each member it includes the integer >>>>> identifier, the type and the value. Is there any way to have it also >>>>> include the symbolic name for each member? >>>>> >>>>> I wouldn't use this during over the wire run-time (I won't even being >>>> using >>>>> JSON) but I would like to use this when reading and writing to the >> config >>>>> files. >>>>> >>>>> Thank you for any help. >> >>
