| 969 | */ |
| 970 | |
| 971 | bool Json::has_shape(const shape & types, string & err) const { |
| 972 | if (!is_object()) { |
| 973 | err = "expected JSON object, got " + dump(); |
| 974 | return false; |
| 975 | } |
| 976 | |
| 977 | for (auto & item : types) { |
| 978 | if ((*this)[item.first].type() != item.second) { |
| 979 | err = "bad type for " + item.first + " in " + dump(); |
| 980 | return false; |
| 981 | } |
| 982 | } |
| 983 | |
| 984 | return true; |
| 985 | } |
| 986 | |
| 987 | } // namespace json11 |
| 988 |