From 028e596cffcf3d508cc8412d6c4095bb62b07c86 Mon Sep 17 00:00:00 2001 From: yaoyuan Date: Mon, 4 Aug 2025 15:07:11 +0800 Subject: [PATCH] CherryPick Disable json from 0702 to 0728 Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICQXMF Signed-off-by: yaoyuan --- api/@ohos.util.json.d.ts | 59 ++++++---------------------------------- kits/@kit.ArkTS.d.ets | 3 +- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/api/@ohos.util.json.d.ts b/api/@ohos.util.json.d.ts index 1f01a71ebf..03abf5a6a4 100644 --- a/api/@ohos.util.json.d.ts +++ b/api/@ohos.util.json.d.ts @@ -25,8 +25,7 @@ * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare namespace json { /** @@ -39,8 +38,7 @@ declare namespace json { * @returns { Object | undefined | null } Return an Object, undefined or null value * @syscap SystemCapability.Utils.Lang * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ type Transformer = (this: Object, key: string, value: Object) => Object | undefined | null; @@ -64,22 +62,6 @@ declare namespace json { */ function parse(text: string, reviver?: Transformer, options?: ParseOptions): Object | null; - /** - * Converts a JavaScript Object Notation (JSON) string into an Object or null. - * - * @param { string } text - A valid JSON string. - * @param { Type } type - A constructor or class representing the expected type of the parsed result. - * @param { Transformer } [reviver] - A function that transforms the results. - * @param {ParseOptions} options - The config of parse. - * @returns { T | null | undefined } Return an Object, array, string, number, boolean, undefined, or null value corresponding to JSON text. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - function parse(text: string, type: Type, reviver?: Transformer, options?: ParseOptions): T | null | undefined; - /** * Converts an ArkTS object or array into a JSON string. In the case of a container, linear containers are supported, * but non-linear containers are not. @@ -105,22 +87,6 @@ declare namespace json { */ function stringify(value: Object, replacer?: (number | string)[] | null, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * - * @param { NullishType } value - A JavaScript value, usually an NullishType or array. - * @param { Transformer | ((double | string)[]) | null } [replacer] - An array of strings and numbers that acts as an approved list - * for selecting the object properties that will be stringify. - * @param { string | int } [space] - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - * @returns { string } Return a JSON text. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - function stringify(value: NullishType, replacer?: Transformer | ((double | string)[]) | null, space?: string | int): string; - /** * Converts an ArkTS object or array into a JSON string. In the case of a container, linear containers are supported, * but non-linear containers are not. @@ -155,8 +121,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function has(obj: object, property: string): boolean; @@ -180,8 +145,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ const enum BigIntMode { /** @@ -190,8 +154,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ DEFAULT = 0, /** @@ -200,8 +163,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ PARSE_AS_BIGINT = 1, /** @@ -210,8 +172,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ ALWAYS_PARSE_AS_BIGINT = 2, } @@ -223,8 +184,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface ParseOptions { /** @@ -233,8 +193,7 @@ declare namespace json { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ bigIntMode: BigIntMode; } diff --git a/kits/@kit.ArkTS.d.ets b/kits/@kit.ArkTS.d.ets index a495996fb8..aa4e35f709 100644 --- a/kits/@kit.ArkTS.d.ets +++ b/kits/@kit.ArkTS.d.ets @@ -27,7 +27,6 @@ import util from '@ohos.util'; import Deque from '@ohos.util.Deque'; import LightWeightMap from '@ohos.util.LightWeightMap'; import Queue from '@ohos.util.Queue'; -import JSON from '@ohos.util.json'; import stream from '@ohos.util.stream'; import HashMap from '@ohos.util.HashMap'; import HashSet from '@ohos.util.HashSet'; @@ -44,5 +43,5 @@ import Decimal from '@arkts.math.Decimal'; export { ArrayList, Deque, HashMap, HashSet, LightWeightMap, LightWeightSet, LinkedList, List, - PlainArray, Queue, Stack, TreeMap, TreeSet, buffer, uri, url, util, JSON, stream, xml, collections, Decimal + PlainArray, Queue, Stack, TreeMap, TreeSet, buffer, uri, url, util, stream, xml, collections, Decimal }; -- Gitee