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
2
votes
0 answers

Deserializing struct with TreatValueAsRefType in ServiceStack.Text

Migrating to ServiceStack I faced serialization issue in (de)serializing struct. On struct I can override ToString() and add static Parse() method but then the output of serialization is string, which is escaped into JSON. I would prefer the same…
eXavier
  • 4,821
  • 4
  • 35
  • 57
2
votes
1 answer

ServiceStack exception serialization behaviour

Disclaimer: I'm fairly new to ServiceStack Given the following Service: public class TestService : Service { public TestResponse Get(Test request) { if (String.IsNullOrEmpty(request.Message)) throw new…
2
votes
1 answer

Class attribute [JsonConverter(typeof(StringEnumConverter))] equivalent in ServiceStack

Is there [JsonConverter(typeof(StringEnumConverter))] equivalent attribute class in ServiceStack? This is a Newtonsoft for converting enum to string?
Val
  • 1,023
  • 3
  • 10
  • 21
2
votes
0 answers

ServiceStack vs StackExpress & non pre-release versions of StackExpress

I was wondering if the only difference between StackExpress & ServiceStack is that the dynamic handling for .net 4, which is in StackExpress but not ServiceStack. (specifically in servicestack.text ) As such will StackExpress ever be non-pre…
James
  • 1,380
  • 11
  • 11
1
vote
1 answer

ServiceStack HttpUtils - How to get error body using .NET 6

Is there a way to capture the error message using ServiceStack HttpUtils from my .NET 6 project. Now it returns an empty string... try { var response = await GetApiUrl().CombineWith("/Controller/DoSomething").PostJsonToUrlAsync(body); } catch…
Nesse
  • 373
  • 4
  • 14
1
vote
1 answer

How to send down a List with ServiceStack?

So here's my DTO, when I debug I CLEARLY see the Roles list populated... but in the endpoint /RestApi/myroute?format=json (or any format) there's nothing there. Tried changing List to a dto object, same deal. public class PageItemDto { …
Steve McNiven-Scott
  • 1,770
  • 2
  • 15
  • 29
1
vote
1 answer

How to define JSON attribute on model binding using ServiceStack

I am developing a custom module for a 3rd party application that is using ServiceStack for API calls. The problem is that the JSON response is using snake case for keys and my Class using Dotnet standard PascalCase for defining properties. I don't…
1
vote
1 answer

Empty Object when deserializing ViewPort object with ServiceStack

I'm having an issue since I migrated to the latest version of GoogleApi (by Vivet) After analyzing I have identified a problem with deserializing the ViewPort object (this object was changed ). This only happens with the chosen serializer…
1
vote
1 answer

ServiceStack ORMLite JSON Deserialization multiple levels

I've got a class containing a Dictionary like this: Dictionary Data I put data on multiple levels into here, such as: Data.Add("simple",4); Data.Add("object",new Dictionary{{"key",4}}); Data.Add("array",new…
specimen
  • 1,735
  • 14
  • 23
1
vote
1 answer

Extension method .ToJsv() from ServiceStack.Text ignores null values in collections

My test class: public class TestA { public IEnumerable Collection { get; set; } } When I call extension method .ToJsv() from ServiceStack.Text on TestA object with property Collection which is an array with some null values, the result…
DannyS
  • 11
  • 2
1
vote
1 answer

Why does UserAuthExtensions.PopulateFromMap(session, jwtPayload) does not deserialize json values with escape correctly in ServiceStack.Auth?

We want to get the UserName from the ServiceStack session, but we find that the backslashes in the UserName are not deserialized as expected. The UserName has this format 'domainname\username' and serialized in a jwt token this looks like: { …
1
vote
1 answer

How to use ServiceStack to store POCOs to MariaDB having complex types (objects and structs) blobbed as JSON?

I've got following setup: C#, ServiceStack, MariaDB, POCOs with objects and structs, JSON. The main question is: how to use ServiceStack to store POCOs to MariaDB having complex types (objects and structs) blobbed as JSON and still have working…
1
vote
1 answer

ServiceStack.Text json serializer deserializes raw string with brackets as jsv

I have some JSON text and I want to deserialize it into a Dictionary. ServiceStack.Text does that no problem, until there are brackets inside the string values. Then it decides to deserialize that string, as if it was JSV…
prok_8
  • 309
  • 2
  • 15
1
vote
1 answer

ServiceStack Deserialize int (unix timestamp in ms) to DateTime

Here is a snippet of my current class: As you can see I'm deserializing to a long and then once it's done it calls the OnDeserialized method to finish up. Does ServiceStack have a better way to do that? Possibly a more direct way to so I won't…
LorneCash
  • 1,446
  • 2
  • 16
  • 30
1
vote
1 answer

How to Deserialize json to one of several DataContracts with ServiceStack

I'm connected to a websocket and subscribed to the MessageRecieved event. In that event I will get a string (json) that could be deserialized to any of about 5 different DataContracts. Right now I'm just using a switch statement with a unique bit…
LorneCash
  • 1,446
  • 2
  • 16
  • 30