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
4
votes
1 answer

Deserialize Json into a dynamic object with ServiceStack.Text

I am using ServiceStack.Text to deserialize json into a dynamic object. I'm encountering an error when trying to deserialize the following json: { "responseHeader":{ "status":0, "QTime":3, "params":{ "q":"*:*", …
Control Freak
  • 12,965
  • 30
  • 94
  • 145
4
votes
1 answer

ServiceStack returning JSV instead of JSON

I have a service created with ServiceStack. Recently I updated the ServiceStack libraries and now I am getting JSV responses instead of JSON responses. The request looks something like: POST…
niltz
  • 1,014
  • 11
  • 28
3
votes
1 answer

ServiceStack.Text strange behavior while deserializing nullable boolean

Suppose I have a class containing a member with bool? type. public class Request { public bool? IsOk {get; set;} } I expect ServiceStack's JSON deserializer that any values other than true or false in a JSON string result in null for this…
3
votes
1 answer

ServiceStack deserialize xml to object

My current method for deserialization looks like this: public static object Deserialize(string xml, Type toType) { object result = null; using (var stream = new MemoryStream()) { var data = Encoding.UTF8.GetBytes(xml); …
LorneCash
  • 1,446
  • 2
  • 16
  • 30
3
votes
2 answers

Couchbase Lite 2 + JsonConvert

The following code sample writes a simple object to a couchbase lite (version 2) database and reads all objects afterwards. This is what you can find in the official documentation here This is quite a lot of manual typing since every property of…
Tho Mai
  • 835
  • 5
  • 25
3
votes
1 answer

Servicestack.Text ConvertTo<> tomap properties with different names or any other solution for this?

Consider I have these classes in my Api model, because other actions may need customerData with different attributes I hide base properties like this: public class CustomerData { public string Name { get; set; } public string PublicKey {…
someone
  • 535
  • 4
  • 14
3
votes
1 answer

Prevent serializing default value types with ServiceStack Json

Some of my contracts have quite a few int/decimal/short/byte etc. properties which often have default values. I don't want to serialize these properties if they are default values as that ends up taking quite a bit of bandwidth and in my situation…
laurencee
  • 818
  • 1
  • 7
  • 15
3
votes
1 answer

How can I convert a JavaScript object(JSON) into JSV format?

I am looking to use JSV rather than JSON to save bandwidth when sending my ajax requests to my ServiceStack service. I have the following JSON data: [{"201":"New York","022":"Chicago"}] And I would like to convert it to the following JSV…
Shiljo Paulson
  • 518
  • 7
  • 17
3
votes
2 answers

How do I stop ServiceStack 3.9.71 NuGet package installing ServiceStack.Text 4.0.24?

I have a project that uses ServiceStack; we're running the old 3.9.x codebase rather than upgrading to 4.x, since ServiceStack 4 requires a commercial license. My own API client has a dependency defined in the .nuspec file as…
3
votes
1 answer

Is it possible to set custom (de)serializers for open generic types in ServiceStack.Text?

I have a type like this: class Foo { public string Text { get; set; } public T Nested { get; set; } public static string ToJson(Foo foo) { [...] } } ToJson serializes a Foo instance to JSON in a way that is impossible to achieve…
ygormutti
  • 358
  • 3
  • 17
3
votes
1 answer

ServiceStack.Text Serializer as default serializer/deserializer

We are just starting to develop our new API client using ASP.net Web Api. Having found ServiceStack.Text i do not want to use JSON.NET serialization feature but replace them with ServiceStack. How to set this serializer as default in Web Api? Thanks…
Romko
  • 1,808
  • 21
  • 27
3
votes
2 answers

ServiceStack does not escape control characters in JSON

ServiceStack's JsonSerializer does not seem to encode control characters correctly. For example, this C# expression.... JsonSerializer.SerializeToString(new { Text = "\u0010" }) ... evaluates to this... {"Text":"?"} ... where the "?" is the…
Bobby
  • 43
  • 5
3
votes
1 answer

JsConfig.EmitLowercaseUnderscoreNames for deserialization

I need lowercase_underscore_names for my REST client. JsConfig.EmitLowercaseUnderscoreNames setting works fine only for serialization (JSON). Now I use DataContract and DataMember attributes to deserialize my models correctly. But is there any…
3
votes
1 answer

ServiceStack Json Serializer ignore properties

I have a business requirement to only send permissioned properties in our response payload. For instance, our response DTO may have several properties, and one of them is SSN. If the user doesn't have permissions to view the SSN then I would never…
Nick H
  • 245
  • 2
  • 13
3
votes
1 answer

ServiceStack.Text and DeserializeFromString

I most admit that I'm probably forgetting something really simple, but I can't figure it out what I have a class: public class UserAgentInfo { public string agent_type { get; set; } public string agent_name { get; set; } public string…
balexandre
  • 73,608
  • 45
  • 233
  • 342
1
2
3
14 15