diff --git a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts index 4b41a23252564545ee86d45898b1e25d4f920af6..fa754163c657e3b6cba68e56de547905a6dbdfd5 100644 --- a/uni_modules/uts-tests/utssdk/UTSJSONObject.uts +++ b/uni_modules/uts-tests/utssdk/UTSJSONObject.uts @@ -93,6 +93,21 @@ export function testUTSJSONObject() : Result { expect(data5!.toJSONString()).toEqual('{"data4":{"data":{"num":1,"num2":2.369,"str":"test"},"name":"张三"}}') + class TestData6 implements IJsonStringify{ + toJSON():any|null{ + return JSON.parse("22") + } + } + let testData6 = TestData6() + let data6 = { + data:testData6, + array:[1,"22",false], + name:"data6" + } + + expect(data6!.toJSONString()).toEqual('{"data":22.0,"array":[1,"22",false],"name":"data6"}') + console.log(data6.toJSONString()) + // #endif })