1 #include "lib/spotify/searchresults.hpp"
2 
to_json(nlohmann::json & j,const search_results & s)3 void lib::spt::to_json(nlohmann::json &j, const search_results &s)
4 {
5 	j = nlohmann::json{
6 		{"albums", s.albums},
7 		{"artists", s.artists},
8 		{"tracks", s.tracks},
9 		{"playlists", s.playlists},
10 	};
11 }
12 
from_json(const nlohmann::json & j,search_results & s)13 void lib::spt::from_json(const nlohmann::json &j, search_results &s)
14 {
15 	if (!j.is_object())
16 		return;
17 
18 	j.at("albums").at("items").get_to(s.albums);
19 	j.at("artists").at("items").get_to(s.artists);
20 	j.at("playlists").at("items").get_to(s.playlists);
21 	j.at("tracks").at("items").get_to(s.tracks);
22 }
23