Generate POCO's from JSON schemas

Hi @mythz,

Is there a tool from ServiceStack.Text that can be used to generate POCO’s from a valid draft v.3/v.4 Json Schema?

Something like: http://www.newtonsoft.com/jsonschema

I’m having some issues on url references, and I would prefer to debug and help with your code instead if there’s something already available :smile:

Just wondering as I’m about to help re-write the MailChimp .NET Wrapper and it would be extremely helpful :slight_smile:

I’m trying to generate POCO’s from the MailChimp API v.3 Json Schema

Hi Bruno, no sorry we don’t have anything like that, but as it’s just POCOs I’d expect you’d be able to go a pretty long way just using JSON.NETs schema to generate the POCO models which you should be able to reuse a lot of in ServiceStack.

Although my preference whenever dealing with a 3rd Party API is just to create the code-first POCO data models by hand which I’ve done previously at:

…is just to create the code-first POCO data models by hand…

seems painful :stuck_out_tongue:

This is what I’ve done so far:

https://gist.github.com/balexandre/e8cd6a965cdc532cb6ae

runs fine on LinqPad so you can see:

  • copy/paste
  • choose C# Program
  • press F4 > Nuget > add Newtonsoft.Json.Schema
  • Alt + X

:blush:

1 Like