C
C#2y ago
Cuda

✅ Saving api json data to db

So I'm not sure how to go about in saving data from a website that provides json data. Like what is the standard way ?
8 Replies
Denis
Denis2y ago
Depends where you want to store it? This differs from use case to use case
Cuda
Cuda2y ago
So do we just typically write this data into a db/table? And that's it? I'm not sure how we go about tracking what's changed if that makes sense..
BananaPie
BananaPie2y ago
imo, you would have an anti-corruption layer in your code to parse the json data into model(s) that your app can understand. then when you save / pull the data, you can check what got changed, maybe put your own version tracking logic
Angius
Angius2y ago
You want to version your data or something? If so, a separate history table would be one choice, a single table with additional version column or some such would be another
Denis
Denis2y ago
If you use Azure storage you can enable changes tracking I believe it is available for the LTP (or smth like that) storage type
Shinyshark
Shinyshark2y ago
You could use JsonConvert to deserialize it into an object and save that to your database. You can map the data from your deserialized model to your database entity
Cuda
Cuda2y ago
Thank you all!! All great suggestions! Love this discorf!!!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.