1 #include "lib/spotify/device.hpp"
2 
to_json(nlohmann::json & j,const device & d)3 void lib::spt::to_json(nlohmann::json &j, const device &d)
4 {
5 	j = nlohmann::json{
6 		{"id", d.id},
7 		{"name", d.name},
8 		{"type", d.type},
9 		{"is_active", d.is_active},
10 		{"volume_percent", d.volume_percent},
11 	};
12 }
13 
from_json(const nlohmann::json & j,device & d)14 void lib::spt::from_json(const nlohmann::json &j, device &d)
15 {
16 	if (!j.is_object())
17 		return;
18 
19 	j.at("id").get_to(d.id);
20 	j.at("name").get_to(d.name);
21 	j.at("type").get_to(d.type);
22 	j.at("is_active").get_to(d.is_active);
23 	j.at("volume_percent").get_to(d.volume_percent);
24 }
25