简体   繁体   中英

How do i convert a json to a byte array in c#

i have pretty much zero experience with this and have tried for a lot longer than id like to admit to make this work but i am at a roadblock and cant make this thing that should be simple work. i am new and know basically nothing about it and i cannot understand the documentation and google searches lead to nothing. it currently being 1 am surely doesnt help either. my current try is this:

byte[] jsonData = new byte[]{JsonSerializer.SerializeToUtf8Bytes({ v: 1,client_id: 332269999912132097})};

could you try this

byte[] obj = yourobj.Tostring().getBytes("UTF-8");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM