1

I have bunch of TimeSpan properties in response from Web API. By default JSON serializer includes decimal values of seconds as well in response. E.G. 08:30:00.000909 These micro-seconds values are not needed in response.

Is it possible to override JSON serializer so that it could skip out milli/micro-second components in the serialized JSON response?

1

1 Answer 1

3

You may want to use custom serializer for your Web API http://tinymission.com/post/custom-serialization-for-json-properties-in-web-api

Or before you convert your DTO to Model, you can use Custom Date and Time Format Strings.

https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.