Parse an inline YAML flow sequence like `[a, b, c]` into a JSON array.
(value: &str)
| 852 | |
| 853 | /// Parse an inline YAML flow sequence like `[a, b, c]` into a JSON array. |
| 854 | fn parse_inline_list(value: &str) -> Option<serde_json::Value> { |
| 855 | let trimmed = value.trim(); |
| 856 | if !trimmed.starts_with('[') || !trimmed.ends_with(']') { |
| 857 | return None; |
| 858 | } |
| 859 | let inner = trimmed[1..trimmed.len() - 1].trim(); |
| 860 | if inner.is_empty() { |
| 861 | return Some(serde_json::Value::Array(Vec::new())); |
| 862 | } |
| 863 | let items: Vec<serde_json::Value> = inner |
| 864 | .split(',') |
| 865 | .map(|item| yaml_scalar_to_json(item.trim())) |
| 866 | .collect(); |
| 867 | Some(serde_json::Value::Array(items)) |
| 868 | } |
| 869 | |
| 870 | /// Parse an inline YAML flow mapping like `{a: 1, b: true}` into a JSON object. |
| 871 | fn parse_inline_map(value: &str) -> Option<serde_json::Value> { |
no test coverage detected