I have a response from API which looks like a JSON, But it isn't.
[ { detection:
FaceDetection {
_imageDims: [Dimensions],
_score: 0.8957952857017517,
_classScore: 0.8957952857017517,
_className: '',
_box: [Box] },
landmarks:
FaceLandmarks68 { _imgDims: [Dimensions], _shift: [Point], _positions: [Array] },
unshiftedLandmarks:
FaceLandmarks68 { _imgDims: [Dimensions], _shift: [Point], _positions: [Array] },
alignedRect:
FaceDetection {
_imageDims: [Dimensions],
_score: 0.8957952857017517,
_classScore: 0.8957952857017517,
_className: '',
_box: [Box] },
descriptor:
Float32Array [
-0.1426914483308792,
0.08866042643785477,
]
As you can see the face detection is not a key-value pair but a function. ( This understood from here: No colon after property name in object declaration, is it valid? ).But when I try to serialize this, it will avoid those functions and only take the key-value pair. So how should I serialize this without losing anything?
Things I have tried so far is, JSON.stringify(), which obviously don't work. Other is an NPM package https://www.npmjs.com/package/serialize-javascript
So how should I serialize this object without losing functions inside?