@@ -44,6 +44,7 @@ type rec t = Stdlib_JSON.t =
4444  | Object (dict <t >)
4545  | Array (array <t >)
4646
47+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
4748module  Kind : {
4849  type  json  =  t 
4950  /** Underlying type of a JSON value */ 
@@ -56,6 +57,7 @@ module Kind: {
5657    | Null : t <Js_types .null_val >
5758}
5859
60+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
5961type  tagged_t  = 
6062  | JSONFalse 
6163  | JSONTrue 
@@ -67,48 +69,67 @@ type tagged_t =
6769
6870/* ## Accessors */ 
6971
72+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
7073let  classify : t  =>  tagged_t 
7174
7275/** 
7376`test(v, kind)` returns `true` if `v` is of `kind`. 
7477*/ 
78+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
7579let  test : ('a , Kind .t <'b >) =>  bool 
7680
7781/** 
7882`decodeString(json)` returns `Some(s)` if `json` is a `string`, `None` otherwise. 
7983*/ 
8084@deprecated ({
81-   reason : "Use pattern matching instead." ,
82-   migrate : switch  %insert.unlabelledArgument (0 ) {
83-   | JSON .String (str ) =>  Some (str )
84-   | _  =>  None 
85-   },
85+   reason : "Use `JSON.Decode.string` instead." ,
86+   migrate : JSON .Decode .string (),
8687})
8788let  decodeString : t  =>  option <Js_string .t >
8889
8990/** 
9091`decodeNumber(json)` returns `Some(n)` if `json` is a `number`, `None` otherwise. 
9192*/ 
93+ @deprecated ({
94+   reason : "Use `JSON.Decode.float` instead." ,
95+   migrate : JSON .Decode .float (),
96+ })
9297let  decodeNumber : t  =>  option <float >
9398
9499/** 
95100`decodeObject(json)` returns `Some(o)` if `json` is an `object`, `None` otherwise. 
96101*/ 
102+ @deprecated ({
103+   reason : "Use `JSON.Decode.object` instead." ,
104+   migrate : JSON .Decode .object (),
105+ })
97106let  decodeObject : t  =>  option <dict <t >>
98107
99108/** 
100109`decodeArray(json)` returns `Some(a)` if `json` is an `array`, `None` otherwise. 
101110*/ 
111+ @deprecated ({
112+   reason : "Use `JSON.Decode.array` instead." ,
113+   migrate : JSON .Decode .array (),
114+ })
102115let  decodeArray : t  =>  option <array <t >>
103116
104117/** 
105118`decodeBoolean(json)` returns `Some(b)` if `json` is a `boolean`, `None` otherwise. 
106119*/ 
120+ @deprecated ({
121+   reason : "Use `JSON.Decode.bool` instead." ,
122+   migrate : JSON .Decode .bool (),
123+ })
107124let  decodeBoolean : t  =>  option <bool >
108125
109126/** 
110127`decodeNull(json)` returns `Some(null)` if `json` is a `null`, `None` otherwise. 
111128*/ 
129+ @deprecated ({
130+   reason : "Use JSON.Decode.null instead." ,
131+   migrate : JSON .Decode .null (),
132+ })
112133let  decodeNull : t  =>  option <Js_null .t <'a >>
113134
114135/* ## Constructors */ 
@@ -119,22 +140,46 @@ let decodeNull: t => option<Js_null.t<'a>>
119140*/ 
120141
121142/** `null` is the singleton null JSON value. */ 
143+ @deprecated ({
144+   reason : "Use `JSON.Encode.null` instead." ,
145+   migrate : JSON .Encode .null ,
146+ })
122147@val 
123148external  null : t  =  "null" 
124149
125150/** `string(s)` makes a JSON string of the `string` `s`. */ 
151+ @deprecated ({
152+   reason : "Use `JSON.Encode.string` instead." ,
153+   migrate : JSON .Encode .string (),
154+ })
126155external  string : string  =>  t  =  "%identity" 
127156
128157/** `number(n)` makes a JSON number of the `float` `n`. */ 
158+ @deprecated ({
159+   reason : "Use `JSON.Encode.float` instead." ,
160+   migrate : JSON .Encode .float (),
161+ })
129162external  number : float  =>  t  =  "%identity" 
130163
131164/** `boolean(b)` makes a JSON boolean of the `bool` `b`. */ 
165+ @deprecated ({
166+   reason : "Use `JSON.Encode.bool` instead." ,
167+   migrate : JSON .Encode .bool (),
168+ })
132169external  boolean : bool  =>  t  =  "%identity" 
133170
134171/** `object_(dict)` makes a JSON object of the `dict`. */ 
172+ @deprecated ({
173+   reason : "Use `JSON.Encode.object` instead." ,
174+   migrate : JSON .Encode .object (),
175+ })
135176external  object_ : dict <t > =>  t  =  "%identity" 
136177
137178/** `array_(a)` makes a JSON array of the `Js.Json.t` array `a`. */ 
179+ @deprecated ({
180+   reason : "Use `JSON.Encode.array` instead." ,
181+   migrate : JSON .Encode .array (),
182+ })
138183external  array : array <t > =>  t  =  "%identity" 
139184
140185/* 
@@ -144,15 +189,31 @@ external array: array<t> => t = "%identity"
144189*/ 
145190
146191/** `stringArray(a)` makes a JSON array of the `string` array `a`. */ 
192+ @deprecated ({
193+   reason : "Use `JSON.Encode.stringArray` instead." ,
194+   migrate : JSON .Encode .stringArray (),
195+ })
147196external  stringArray : array <string > =>  t  =  "%identity" 
148197
149198/** `numberArray(a)` makes a JSON array of the `float` array `a`. */ 
199+ @deprecated ({
200+   reason : "Use `JSON.Encode.floatArray` instead." ,
201+   migrate : JSON .Encode .floatArray (),
202+ })
150203external  numberArray : array <float > =>  t  =  "%identity" 
151204
152205/** `booleanArray(a)` makes a JSON array of the `bool` array `a`. */ 
206+ @deprecated ({
207+   reason : "Use `JSON.Encode.boolArray` instead." ,
208+   migrate : JSON .Encode .boolArray (),
209+ })
153210external  booleanArray : array <bool > =>  t  =  "%identity" 
154211
155212/** `objectArray(a) makes a JSON array of the `JsDict.t` array `a`. */ 
213+ @deprecated ({
214+   reason : "Use `JSON.Encode.objectArray` instead." ,
215+   migrate : JSON .Encode .objectArray (),
216+ })
156217external  objectArray : array <dict <t >> =>  t  =  "%identity" 
157218
158219/* ## String conversion */ 
@@ -207,7 +268,12 @@ let getIds = s => {
207268Js.log(getIds(` { "ids" : [1, 2, 3 ] } `)) 
208269``` 
209270*/ 
210- @val  @scope ("JSON" )
271+ @deprecated ({
272+   reason : "Use `JSON.parseOrThrow` instead." ,
273+   migrate : JSON .parseOrThrow (),
274+ })
275+ @val 
276+ @scope ("JSON" )
211277external  parseExn : string  =>  t  =  "parse" 
212278
213279/** 
@@ -229,7 +295,12 @@ Js.Dict.set(dict, "likes", Js.Json.stringArray(["ReScript", "ocaml", "js"]))
229295Js.log(Js.Json.stringify(Js.Json.object_(dict))) 
230296``` 
231297*/ 
232- @val  @scope ("JSON" )
298+ @deprecated ({
299+   reason : "Use `JSON.stringify` instead." ,
300+   migrate : JSON .stringify (),
301+ })
302+ @val 
303+ @scope ("JSON" )
233304external  stringify : t  =>  string  =  "stringify" 
234305
235306/** 
@@ -251,7 +322,12 @@ Js.Dict.set(dict, "likes", Js.Json.stringArray(["ReScript", "ocaml", "js"]))
251322Js.log(Js.Json.stringifyWithSpace(Js.Json.object_(dict), 2)) 
252323``` 
253324*/ 
254- @val  @scope ("JSON" )
325+ @deprecated ({
326+   reason : "Use `JSON.stringify` with optional `~space` instead." ,
327+   migrate : JSON .stringify (~space = %insert.unlabelledArgument (2 )),
328+ })
329+ @val 
330+ @scope ("JSON" )
255331external  stringifyWithSpace : (t , @as (json ` null` ) _ , int ) =>  string  =  "stringify" 
256332
257333/** 
@@ -264,7 +340,12 @@ external stringifyWithSpace: (t, @as(json`null`) _, int) => string = "stringify"
264340Js.log(Js.Json.stringifyAny(["hello", "world"])) 
265341``` 
266342*/ 
267- @val  @scope ("JSON" )
343+ @deprecated ({
344+   reason : "Use `JSON.stringifyAny` instead." ,
345+   migrate : JSON .stringifyAny (),
346+ })
347+ @val 
348+ @scope ("JSON" )
268349external  stringifyAny : 'a  =>  option <string > =  "stringify" 
269350
270351/** 
@@ -275,6 +356,7 @@ It is unsafe in two aspects
275356- It may throw during  parsing 
276357- when you cast it to a specific type, it may have a type mismatch 
277358*/ 
359+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
278360let  deserializeUnsafe : string  =>  'a 
279361
280362/** 
@@ -283,4 +365,5 @@ It will raise in such situations:
283365- There are cycles 
284366- Some JS engines can not stringify deeply nested json objects 
285367*/ 
368+ @deprecated ("This functionality has been deprecated and will be removed in v13." )
286369let  serializeExn : 'a  =>  string 
0 commit comments