using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Test.ServiceModel.Types;
namespace Test.ServiceModel.Types
{
public partial class AllCollectionTypes
{
public virtual int[] IntArray { get; set; } = [];
public virtual List<int> IntList { get; set; } = [];
public virtual string[] StringArray { get; set; } = [];
public virtual List<string> StringList { get; set; } = [];
public virtual float[] FloatArray { get; set; } = [];
public virtual List<double> DoubleList { get; set; } = [];
public virtual byte[] ByteArray { get; set; } = [];
public virtual Char[] CharArray { get; set; } = [];
public virtual List<decimal> DecimalList { get; set; } = [];
public virtual Poco[] PocoArray { get; set; } = [];
public virtual List<Poco> PocoList { get; set; } = [];
public virtual Dictionary<string, List<Poco>> PocoLookup { get; set; } = new();
public virtual Dictionary<string, List<Dictionary<String,Poco>>> PocoLookupMap { get; set; } = new();
}
public partial class Poco
{
public virtual string Name { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/AllCollectionTypes HTTP/1.1
Host: test.servicestack.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
intArray:
[
0
],
intList:
[
0
],
stringArray:
[
String
],
stringList:
[
String
],
floatArray:
[
0
],
doubleList:
[
0
],
byteArray: AA==,
charArray:
[
],
decimalList:
[
0
],
pocoArray:
[
{
name: String
}
],
pocoList:
[
{
name: String
}
],
pocoLookup:
{
String:
[
{
name: String
}
]
},
pocoLookupMap:
{
String:
[
{
String:
{
name: String
}
}
]
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { intArray: [ 0 ], intList: [ 0 ], stringArray: [ String ], stringList: [ String ], floatArray: [ 0 ], doubleList: [ 0 ], byteArray: AA==, charArray: [ ], decimalList: [ 0 ], pocoArray: [ { name: String } ], pocoList: [ { name: String } ], pocoLookup: { String: [ { name: String } ] }, pocoLookupMap: { String: [ { String: { name: String } } ] } }