简体   繁体   中英

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.

{ 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?

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.

As already pointed out, that's binary data serialised as 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.

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). Thus there's possibly nothing interesting here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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