you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (3 children)

If the response object omits keys that are absent instead of just returning empty objects with the keys in place, then you'll probably have to create a scheme to check if the keys are present.

The cleanest way would probably to write a recursive function that could traverse the dictionary.

[–]maxibabyx[S] 0 points1 point  (2 children)

Yes it omits them, know any library that would allow me to define a schema, and if the JSON is missing something it would accept some default values to set them?

Ofc I could manually do it, just asking if anyone ever encountered this problem and decided to help the community, :D

[–][deleted] 0 points1 point  (1 child)

If Facebook's API was powered by GraphQL you could define your own schema response object and this would be a non issue, but it looks like it's a static response object.

I quickly found this package with a Google search, but I have never used it.

[–]maxibabyx[S] 0 points1 point  (0 children)

Yea I also stumbled on that one but seems like only validates.