(obj)
| 230 | } |
| 231 | |
| 232 | function deepParseJSONStrings(obj) { |
| 233 | if (Array.isArray(obj)) { |
| 234 | return obj.map((item) => { |
| 235 | if (typeof item === 'string' && item.trim()) { |
| 236 | try { |
| 237 | const parsed = parseWithBigInt(item); |
| 238 | if (isJSONContainer(parsed)) { |
| 239 | return deepParseJSONStrings(parsed); |
| 240 | } |
| 241 | } catch (_) {} |
| 242 | } |
| 243 | return deepParseJSONStrings(item); |
| 244 | }); |
| 245 | } |
| 246 | if (typeof obj === 'object' && obj !== null) { |
| 247 | const newObj = {}; |
| 248 | Object.keys(obj).forEach((key) => { |
| 249 | const value = obj[key]; |
| 250 | if (typeof value === 'string' && value.trim()) { |
| 251 | try { |
| 252 | const parsed = parseWithBigInt(value); |
| 253 | if (isJSONContainer(parsed)) { |
| 254 | newObj[key] = deepParseJSONStrings(parsed); |
| 255 | return; |
| 256 | } |
| 257 | } catch (_) {} |
| 258 | } |
| 259 | newObj[key] = deepParseJSONStrings(value); |
| 260 | }); |
| 261 | return newObj; |
| 262 | } |
| 263 | return obj; |
| 264 | } |
| 265 | |
| 266 | function unpackTopLevelEscapedJSON(value) { |
| 267 | if (typeof value !== 'string' || !value.trim()) return value; |
no test coverage detected