diff --git a/README.md b/README.md index 683881f9f..cedf9af90 100644 --- a/README.md +++ b/README.md @@ -243,8 +243,8 @@ byte[] text = JSON.toJSONBytes(data); import com.alibaba.fastjson2.* val data = ... // Any -val text = text.toJSONString() // String -val bytes = text.toJSONByteArray() // ByteArray +val text = data.toJSONString() // String +val bytes = data.toJSONByteArray() // ByteArray ``` ### 2.5 使用`JSONObject`、`JSONArray` diff --git a/README_EN.md b/README_EN.md index b2892489d..a2b2b5700 100644 --- a/README_EN.md +++ b/README_EN.md @@ -234,8 +234,8 @@ byte[] text = JSON.toJSONBytes(data); import com.alibaba.fastjson2.* val data = ... // Any -val text = text.toJSONString() // String -val bytes = text.toJSONByteArray() // ByteArray +val text = data.toJSONString() // String +val bytes = data.toJSONByteArray() // ByteArray ``` ### 2.5 Use `JSONObject`, `JSONArray` diff --git a/docs/index.md b/docs/index.md index c17a03d8b..aecf3838f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -194,8 +194,8 @@ byte[] text = JSON.toJSONBytes(data); import com.alibaba.fastjson2.* val data = ... // Any -val text = text.toJSONString() // String -val bytes = text.toJSONByteArray() // ByteArray +val text = data.toJSONString() // String +val bytes = data.toJSONByteArray() // ByteArray ``` ### 2.5 使用`JSONObject`、`JSONArray` diff --git a/docs/kotlin_cn.md b/docs/kotlin_cn.md index 50375f5f3..7c00edfc5 100644 --- a/docs/kotlin_cn.md +++ b/docs/kotlin_cn.md @@ -127,14 +127,14 @@ val data = text.into>() // Map ```kotlin val data = "..." // Any -val text = text.toJSONString() // String +val text = data.toJSONString() // String ``` 序列化为字节数组: ```kotlin val data = "..." // Any -val bytes = text.toJSONByteArray() // ByteArray +val bytes = data.toJSONByteArray() // ByteArray ``` ### 2.5 使用`JSONObject`、`JSONArray` diff --git a/docs/kotlin_en.md b/docs/kotlin_en.md index 172d31f48..fdda29e91 100644 --- a/docs/kotlin_en.md +++ b/docs/kotlin_en.md @@ -127,14 +127,14 @@ Serialization as a string: ```kotlin val data = "..." // Any -val text = text.toJSONString() // String +val text = data.toJSONString() // String ``` Serialization as a ByteArray: ```kotlin val data = "..." // Any -val bytes = text.toJSONByteArray() // ByteArray +val bytes = data.toJSONByteArray() // ByteArray ``` ### 2.5 Use `JSONObject`、`JSONArray`