(hierarchy: &Value)
| 1868 | } |
| 1869 | |
| 1870 | fn first_inspector_id(hierarchy: &Value) -> Option<String> { |
| 1871 | hierarchy |
| 1872 | .get("roots") |
| 1873 | .and_then(Value::as_array) |
| 1874 | .and_then(|roots| roots.first()) |
| 1875 | .and_then(|root| { |
| 1876 | root.get("inspectorId") |
| 1877 | .or_else(|| root.get("id")) |
| 1878 | .and_then(Value::as_str) |
| 1879 | }) |
| 1880 | .map(ToOwned::to_owned) |
| 1881 | } |
| 1882 | |
| 1883 | fn node_name(node: &Value) -> String { |
| 1884 | string_value(node, "type") |