is there a way to calculate the size of JSON in b...
# android
r
is there a way to calculate the size of JSON in bytes using Kotlin?
n
Is the json coming in api response or stored in a file ? Which networking library are you using ?
r
I create the JSON by myself using Moshi. and I want to check the size before sending it to the API. I am using retrofit
s
Do you mean a JSON String?
r
Yes! well JSON object is simply a string, right?
c
Wouldn't the calculated size change if you're using gzip?
r
I guess you are right! I tried a couple of things and the size is never accurate .