是否ServiceStack.Text报价pretty的印刷JSON的?

编程入门 行业动态 更新时间:2024-10-10 15:27:06
本文介绍了是否ServiceStack.Text报价pretty的印刷JSON的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

TL; DR:是否有一个内置的方式在ServiceStack.Text产生pretty的印刷JSON

TL;DR: Is there a built-in way in ServiceStack.Text to produce pretty-printed JSON?

我使用 ServiceStack.Text 做JSON序列化。它的作品真的很好,到目前为止,但所创建的JSON(使用 .ToJSON())(通过网络发送时,最有可能节省空间)未格式化用空格或换行符。然而,在某些情况下,这将是不错的JSON格式,便于人类可读性。

I am using ServiceStack.Text for doing JSON serialization. It works really good so far, but the created JSON (using .ToJSON()) is not formated with whitespaces or newlines (most likely to save space when sending over the network). However, in some circumstances it would be nice to have the JSON formatted for easier human-readability.

在使用.dump()方法做某种格式的,但是不会产生有效的JSON(即周围的双引号缺失)。

The .Dump () method does some sort of formatting, however does not produce valid JSON (i.e. the surrounding doublequotes are missing).

推荐答案

在 T.Dump()和 T.PrintDump()扩展在 ServiceStack.Text 的方法仅仅是pretty的格式版本在 JSV格式,它将与该TypeSerializer类或 T.ToJsv()扩展方法。它只是提供数据的对人友好的转储,它不解析的。

The T.Dump() and T.PrintDump() extension methods in ServiceStack.Text are just a pretty formatted version of the JSV Format that's created with the TypeSerializer class or T.ToJsv() Extension method. It is only to provide a human friendly dump of data, it's not parseable.

没有prettyPrint的JSON,我建议安装一个pretty的JSONView扩展Chrome或Firefox,看看pretty的JSON,也可以粘贴在JSON的 JSON prettyprint

There is no PrettyPrint for JSON, I recommend installing a Pretty JSONView extension for Chrome or Firefox to see pretty JSON or you can paste the JSON in jsonprettyprint

更多推荐

是否ServiceStack.Text报价pretty的印刷JSON的?

本文发布于:2023-11-12 10:07:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581182.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Text   ServiceStack   JSON   pretty

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!