ufna / VaRest

REST API plugin for Unreal Engine 4 - we love restfull backend and JSON communications!
https://www.unrealengine.com/marketplace/en-US/product/varest-plugin
MIT License
1.07k stars 292 forks source link

Is there no "serialize object" kind of function? #380

Closed kardall closed 2 years ago

kardall commented 2 years ago

I want to serialize a characters equipment/clothing or whatever else I need/want.

But nothing seems to exist to just iterate over an object, create a json structure from each entry in it. I see C++ code that someone tried to do this.

Am I missing something?

Example:

Character Creator has a "saved variables" object that contains a characters details (appearance) that I want to send to a database for character storage. So I need to basically create an object like:

{
    "characterName":"Person",
    "morphValues": [
        "1.0","2.0","1.1"
    ],
    "hairNames":[
        "long"
    ],
    "apparelNames": [
        "long_sleeved_shirt",
        "cargo_pants"
    ],
    "class":"human_male"
}

image

That is the data structure. I don't care if it has extra things right now... just want it to work, and I can figure out the rest later on the back-end or clean it up manually using a custom struct in blueprint if I have to.

Every other language has it built in, but I am not familiar enough with C++ to try to code my own thing. I will if I have to, but... there should be some way to just 'Serialize Object to VaRest Json Object' that you can then use the "Encode Json to Single String" to attach to a post body in Json for the CallUrl function...

kardall commented 2 years ago

I found a plugin that does exactly what I wanted. It's called DBJson on the marketplace. it's free as well... Maybe you could implement it in your plugin.

chase03 commented 1 year ago

hi! did you know how to use it, struct as varest request object input parameters?

kardall commented 1 year ago

I used a plug in called dbjson which has a serialize and deserialize function.

It let's me take a struct and add it to a string field.

On Wed, Mar 29, 2023, 5:45 a.m. Chase03 @.***> wrote:

hi! did you know how to use it, struct as varest request object input parameters?

— Reply to this email directly, view it on GitHub https://github.com/ufna/VaRest/issues/380#issuecomment-1488450559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA76FH7SFZ5Z23VE5U3BNV3W6QOFTANCNFSM5UJ5UJKA . You are receiving this because you modified the open/close state.Message ID: @.***>

chase03 commented 1 year ago

[image: image.png]i use dbjson plugin deserialize this but return nothing, could you share more detail of your blueprint logic please? Thanks a lot

kardall @.***> 于2023年3月29日周三 23:38写道:

I used a plug in called dbjson which has a serialize and deserialize function.

It let's me take a struct and add it to a string field.

On Wed, Mar 29, 2023, 5:45 a.m. Chase03 @.***> wrote:

hi! did you know how to use it, struct as varest request object input parameters?

— Reply to this email directly, view it on GitHub https://github.com/ufna/VaRest/issues/380#issuecomment-1488450559, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AA76FH7SFZ5Z23VE5U3BNV3W6QOFTANCNFSM5UJ5UJKA

. You are receiving this because you modified the open/close state.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ufna/VaRest/issues/380#issuecomment-1488860099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGGYDMRP2KSTORZ4DYI2IH3W6RJQBANCNFSM5UJ5UJKA . You are receiving this because you commented.Message ID: @.***>

kardall commented 1 year ago

Here is a video for you so you can follow along :) Enjoy :D https://youtu.be/r_jCv7YS5VY