简体   繁体   English

这种数据格式是什么以及如何将其转换为可读文本?

[英]What is this data format and how do I convert it into readable text?

An API is returning me this data in body of the response object. API 在响应对象的主体中向我返回此数据。

{ statusCode: 500,body:'\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0003��]K�0\u0014��J���u*H�2\u00106\u0018�\f� x�%gk MB�~��M�n��\b^�=�}��[��*�\u001a�AY��r<�\u0010\u0018a�2�eV���1[1\u001a,w`�bm\u001a��\u0001J�\t�\u0018^fe�� $�\u0012*\u001ep��)l���/\u0004F�d#�\u0005y�ڶ���Y���s���?\u0017���o�L�\u0010�\u0011�M�>Y�5}mx�#����6\u0004vI���\u000b�:�_w\u0002\\L��d�\rH�>\u001d�Yυ\u0006�I�[8$�Q\u00020\\8�5\r�J��\u0015�t�k�\u0002��V�\r��q?���颀\u000eD\u001d��i��G\u001b�t��@�\u0006\u0014-\u001aï�,\u0012�D�\u0016F��P\\#Q�~�o���#?h?�-�ѩ�DiF��\u0003aԄ�(m��\u001fd0(��\u0006�\b�\'O�&�N\u0005��ڨ�����\u0001\u000f͹\fX؊���\u0018%�\u0011ɍk䷧���d�\u0000\u0000\u0000��\u0003\u00001����\u0002\u0000\u0000'}

Any way I can convert this into a human-readable format in node js?有什么办法可以在节点 js 中将其转换为人类可读的格式?

Couldn't this just be undesired behaviour due to the internal server error?由于内部服务器错误,这难道不是不受欢迎的行为吗? The \\uXXX format is unicode, obviously unsure about the other unrecognised symbols but I doubt the response body holds any value to you. \\uXXX 格式是 unicode,显然不确定其他无法识别的符号,但我怀疑响应正文对您有任何价值。

As already pointed out, that's binary data serialised as JSON.正如已经指出的那样,这是序列化为 JSON 的二进制数据。 But JSON is a text-only data format, it can't handle binary streams, so data is most likely already corrupted when it reaches your side.但是 JSON 是纯文本数据格式,它无法处理二进制流,因此数据在到达您身边时很可能已经损坏。

However, the statusCode: 500 part suggests that the server is just crashing (you're possibly getting a 500 status code in the HTTP response, which is something you should be checking anyway).但是, statusCode: 500部分表明服务器刚刚崩溃(您可能在 HTTP 响应中收到500 状态代码,无论如何您都应该检查一下)。 Thus there's possibly nothing interesting here.因此,这里可能没有什么有趣的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM