jsonquery
jsonquery copied to clipboard
field starts with @
Hello, Evaluating your lib, i noticed that when the field name contains un @ it seems not to work properly (json-ld file)
nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[@type='TVEpisode']"))
Regards
you are means JSON like this {"@type": "123"}, right? not test yet.
yes json like
{
"@context": "http://schema.org",
"@type": "DataFeed",
"dateModified": "2023-10-25T12:05:01Z",
"dataFeedElement": [
{
"@context": [
"http://schema.org",
{
"@language": "fr"
}
],
"@type": "TVEpisode",
"@id": "https://tv.com",
"url": "https://tv.com/video1",
"name": "video 1",
"image": {
"@context": "http://schema.org",
"@type": "ImageObject",
"contentUrl": "https://tv.com/video1",
"additionalProperty": [
{
"@type": "PropertyValue",
"name": "contentAttributes",
"value": [
"iconic",
"poster",
"smallFormat",
"largeFormat"
]
}
]
},
"episodeNumber": 10000,
"partOfSeason": {
"@type": "TVSeason",
"@id": "https://tv.com/season1",
"url": "https://tv.com/season1",
"seasonNumber": 1
},
"partOfSeries": {
"@type": "TVSeries",
"@id": "https://tv.com/series1",
"url": "https://tv.com/series1",
"name": "Quotidien"
},
"potentialAction": [
{
"@type": "WatchAction",
"target": {
"@type": "EntryPoint",
"urlTemplate": "https://tv.com/series1",
"inLanguage": "fr",
"actionPlatform": [
"http://schema.org/AndroidPlatform",
"http://schema.org/DesktopWebPlatform",
"http://schema.org/IOSPlatform",
"http://schema.org/MobileWebPlatform"
]
},
"actionAccessibilityRequirement": {
"@type": "ActionAccessSpecification",
"category": "free",
"availabilityStarts": "2017-01-16T18:40:00Z",
"availabilityEnds": "2029-12-31T20:00:00Z",
"eligibleRegion": [
{
"@type": "Country",
"name": "US"
}
]
}
},
{
"@type": "WatchAction",
"target": {
"@type": "EntryPoint",
"urlTemplate": "https://tv.com/video1",
"inLanguage": "fr",
"actionPlatform": [
"http://schema.org/AndroidTVPlatform"
]
},
"actionAccessibilityRequirement": {
"@type": "ActionAccessSpecification",
"category": "free",
"availabilityStarts": "2017-01-16T18:40:00Z",
"availabilityEnds": "2029-12-31T20:00:00Z",
"eligibleRegion": [
{
"@type": "Country",
"name": "FR"
}
]
}
}
]
}
]
}
The following query returns 1 result
nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[name='video 1']"))
But this other query returns no result
nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[@type='TVEpisode']"))