【发布时间】:2022-01-03 04:27:42
【问题描述】:
我想将 typecipt 对象转换为 JSON
ObjectToConvert = { key : value }
public getJson(key: string, value: string) {
//I passed this values when I called the method : key="attr",value="on"
console.log(JSON.stringify({ ObjectToConvert }))
// The result is {"key":"on"} instead of {"attr":"on"}
我想知道为什么结果不是我作为参数传递的。
【问题讨论】:
标签: javascript json typescript object