leetcode 30 days js challenge
Medium
2633. Convert Object to JSON String
Given an object, return a valid JSON string of that object. You may assume the object only inludes strings, integers, arrays, objects, booleans, and null. The returned string should not include extra spaces. The order of keys should be the same as the order returned by Object.keys()
.
Please solve it without using the built-in JSON.stringify
method.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
object includes strings, integers, booleans, arrays, objects, and null
1 <= JSON.stringify(object).length <= 105
maxNestingLevel <= 1000
all strings will only contain alphanumeric characters
使用 Switch Case:
SheepMon, May 22, 2023