将具有许多 unicode 字符的 Json 转换回标准 json
Convert Json that has many unicode characters back to standard json
我从 webhook 收到 json 负载,但返回的 json 是这样的
payload=%7B%22event%22%3A%7B%22info%22%3A%22REFRESH.INTERIM_PROGRESS%22%2C%22loginName%22%3A%22sbMemKostaSavR4%22%2C%22data%22%3A%7B%22providerAccount%22%3A%7B%22id%22%3A10376130%2C%22providerId%22%3A12292%2C%22isManual%22%3Afalse%2C%22createdDate%22%3A%222017-08-20%22%2C%22aggregationSource%22%3A%22USER%22%2C%22refreshInfo%22%3A%7B%22statusCode%22%3A0%2C%22statusMessage%22%3A%22OK%22%2C%22status%22%3A%22IN_PROGRESS%22%2C%22additionalStatus%22%3A%22ACCOUNT_SUMMARY_RETRIEVED%22%7D%7D%7D%7D%7D
有没有一种简单的方法可以使用大括号将其转换回正常标准 json。我真的不想对它做一个疯狂的 string.Replace
方法。
这对我有用。
HttpUtility.UrlDecode(json);
使用内置 java 函数很容易:
java.net.URLDecoder.decode("YOUR_ENCODED_STR", "UTF-8");
不需要任何外部库。3
我从 webhook 收到 json 负载,但返回的 json 是这样的
payload=%7B%22event%22%3A%7B%22info%22%3A%22REFRESH.INTERIM_PROGRESS%22%2C%22loginName%22%3A%22sbMemKostaSavR4%22%2C%22data%22%3A%7B%22providerAccount%22%3A%7B%22id%22%3A10376130%2C%22providerId%22%3A12292%2C%22isManual%22%3Afalse%2C%22createdDate%22%3A%222017-08-20%22%2C%22aggregationSource%22%3A%22USER%22%2C%22refreshInfo%22%3A%7B%22statusCode%22%3A0%2C%22statusMessage%22%3A%22OK%22%2C%22status%22%3A%22IN_PROGRESS%22%2C%22additionalStatus%22%3A%22ACCOUNT_SUMMARY_RETRIEVED%22%7D%7D%7D%7D%7D
有没有一种简单的方法可以使用大括号将其转换回正常标准 json。我真的不想对它做一个疯狂的 string.Replace
方法。
这对我有用。
HttpUtility.UrlDecode(json);
使用内置 java 函数很容易:
java.net.URLDecoder.decode("YOUR_ENCODED_STR", "UTF-8");
不需要任何外部库。3