DecodeObjectToStr checks if the input is a binary format, if so, it will decode a single Object and return the decoded string.
(in []byte)
| 634 | // DecodeObjectToStr checks if the input is a binary format, if so, |
| 635 | // it will decode a single Object and return the decoded string. |
| 636 | func DecodeObjectToStr(in []byte) string { |
| 637 | if binaryFmt(in) { |
| 638 | var b bytes.Buffer |
| 639 | cbor2JsonOneObject(getReader(string(in)), &b) |
| 640 | return b.String() |
| 641 | } |
| 642 | return string(in) |
| 643 | } |
| 644 | |
| 645 | // DecodeIfBinaryToBytes checks if the input is a binary format, if so, |
| 646 | // it will decode all Objects and return the decoded string as byte array. |