Questions tagged [servicestack-text]

ServiceStack.Text is an independent, dependency-free serialization library that contains ServiceStack's text processing functionality

ServiceStack.Text is an independent, dependency-free serialization library that contains ServiceStack's text processing functionality, including:

  • List item
  • JsonSerializer
  • TypeSerializer (JSV-Format)
  • CsvSerializer
  • T.Dump extension method
  • StringExtensions - Xml/Json/Csv/Url encoding, BaseConvert, Rot13, Hex escape, etc.
  • Stream, Reflection, List, DateTime, etc extensions and utils.
212 questions
18
votes
3 answers

ServiceStack - Is there a way to force all serialized Dates to use a specific DateTimeKind?

I have a POCO like this: public class BlogEntry { public string Title { get; set; } public DateTime Date { get; set; } } Most of the time it's being hydrated from Entity Framework, but it can and will be used outside of Entity…
ryan1234
  • 7,237
  • 6
  • 25
  • 36
11
votes
1 answer

Change CSV delimiter in ServiceStack.Text.CsvSerializer

If possible, how can I change the delimiter from comma to semicolon when using ServiceStack.Text.CsvSerializer?
devghost
  • 560
  • 7
  • 13
10
votes
1 answer

WeakReference returns wrong object

I've noticed a strange behavior in one of our applications recently. Exception=System.InvalidCastException: Unable to cast object of type 'System.Data.SqlClient.SqlTransaction' to type 'System.Byte[]'. at…
Marko Žerajić
  • 201
  • 1
  • 7
10
votes
1 answer

Why does ServiceStack emit local time even if date was UTC in JSON?

Long story short- a date round tripped through ServiceStack.Text's JSON parser loses time zone information. Oddly enough, DateTimeSerializerTests.DateTime_Is_Serialized_As_Utc_and_Deserialized_as_local() seems to expect this behavior, and…
Dan McGee
  • 161
  • 1
  • 8
10
votes
1 answer

Using ServiceStack.Text to deserialize a json string to object

I have a JSON string that looks like: "{\"Id\":\"fb1d17c7298c448cb7b91ab7041e9ff6\",\"Name\":\"John\",\"DateOfBirth\":\"\\/Date(317433600000-0000)\\/\"}" I'm trying to deserialize it to object (I'm implementing a caching interface) The trouble I'm…
Alex
  • 37,502
  • 51
  • 204
  • 332
10
votes
3 answers

Is F# aware of its discriminated unions' compiled forms?

A discriminated union in F# is compiled to an abstract class and its options become nested concrete classes. type DU = A | B DU is abstract while DU.A and DU.B are concrete. With ServiceStack, the serialization of types to JSON strings and back can…
philderbeast
  • 267
  • 2
  • 8
7
votes
1 answer

How to use F# Union types with Servicestack JSON serialization?

I guess it is too much I am asking from a framework. But just wondering if it is possible at all. Or what will be work around for this. JSON.Net with new release started supporting F# union types. What is the work around for that, means if I am…
kunjee
  • 2,739
  • 1
  • 23
  • 38
7
votes
1 answer

Where is JsonDateHandler enum gone in ServiceStack version 4.0.5.0 (current Nuget Version)?

I cannot find the JsonDateHandler enum in the current Nuget ServiceStack version 4.0.5.0. Any pointers?
Matt
  • 7,004
  • 11
  • 71
  • 117
7
votes
3 answers

How can I customize the serialization/deserialization of a complex type in ServiceStack.OrmLite

I am using ServiceStack.OrmLite to persist data in a SQLite database, and quite happy with it so far. However, many of my objects have properties of a complex type which I don't want serialized using JSV. I need to be able to specify a custom…
Erwin Mayer
  • 18,076
  • 9
  • 88
  • 126
6
votes
1 answer

Problems de-serializing System.Security.Claims.Claim

I'm implementing an oAuth server and need to store refresh tokens, to do this I have (at the moment) chosen to serialize the tokens into JSON. While I can see that the JSON includes everything that would be needed to rehydrate, when I de-serialize…
andycwk
  • 826
  • 2
  • 9
  • 19
5
votes
3 answers

ServiceStack JSON serializing to lower case on dotnet core?

I'm using ServiceStack to run a REST API and am running into issues serializing the response object. More specifically, when I call JsonSerializer.SerializeToString(.) on the response object all property names are serialized in lower case. I've…
5
votes
1 answer

What is the ServiceStack.Text-equivalent of Json.NET Converters, for example when applied to NodaTime types?

How can I control the serialization/deserialization of custom types (such as NodaTime.LocalDateTime) with ServiceStack.Text? Json.NET provides Converters for this, so that each time a class contains a custom type, the corresponding custom…
Erwin Mayer
  • 18,076
  • 9
  • 88
  • 126
4
votes
0 answers

C# ServiceStack.Text analyze stream of json

I am creating a json deserializer. I am deserializing a pretty big json file (25mb), which contains a lot of information. It is an array for words, with a lot of duplicates. With NewtonSoft.Json, I can deserialize the input as stream: using (var fs…
Kristian Barrett
  • 3,574
  • 2
  • 26
  • 40
4
votes
2 answers

How to serialize object to JSON using DataAnnotation to format double property using ServiceStack request

Using ServiceStack I need to format this request in order that the CodValue property stays in this format #.# [DataContract(Name = "request1")] public class Request1 { [DataMember(Name = "codValue")] public double CodValue { get; set; } } var…
4
votes
1 answer

ServiceStack CSV serializer putting extra quotes around serialized date

I'm using ServiceStack in my site to allow users to download a csv of one of the system's datasets. In the configure method of my AppHost, I'm providing a custom serializer for DateTime. It looks like this JsConfig.SerializeFn = time => …
Dustin Hodges
  • 4,110
  • 3
  • 26
  • 41
1
2 3
14 15