Does Servicestack ORM support saving of JSON data in Postgres? I am looking for a simple example where I can save JSON test into postgress …not a DTO serialized to JSON. Some thing like
Yeah there’s limited support for PostgreSQL’s rich JSON and Array data types, you can use the [Pgsql*] attributes to create tables with the appropriate PostgreSQL type, e.g:
public class ModelWithJsonType
{
public int Id { get; set; }
[PgSqlJson]
public ComplexType ComplexTypeJson { get; set; }
[PgSqlJsonB]
public ComplexType ComplexTypeJsonb { get; set; }
}
public class PgsqlData
{
public Guid Id { get; set; }
[PgSqlIntArray]
public int[] Ints { get; set; }
[PgSqlTextArray]
public string[] Strings { get; set; }
[PgSqlIntArray]
public List<int> ListInts { get; set; }
[PgSqlTextArray]
public List<string> ListStrings { get; set; }
}
Which you can Save/Insert but there’s no Typed API to be able to query PostgreSQL types so you’d need to use PostgreSQL’s Custom SQL to perform any queries on them, some examples in: