What is Nostr?
Bob Wyman /
npub1k40…sznu
2023-03-31 23:15:25
in reply to nevent1q…k7yk

Bob Wyman on Nostr: #[0] #[1] Consider this object: {"object": { "type": "Note", "content": "<p>Some ...

npub1u27r9h3j9pvrplaffsmpn698e8xhmuqhdgcxldv67ammql9pumnqha3qfq (npub1u27…3qfq) npub177x40845gmz06jsrpkqvrww3skwn6yj2cx2xk6ynzakn5xr7j72suzpv55 (npub177x…pv55) Consider this object:
{"object": {
"type": "Note",
"content": "<p>Some Text<div>1st div</div><div>2nd div</div></p>"
}}

If I treat HTML like JSON, I can fetch the content of the first div with JSONPath like:
"$..object[?(@.type == 'Note')].content.p.div[0]"

but, the XPath for that first div would be "//p/div[1]" (Note: 1-base, not 0-base) So, should the full query be the following?:
"$..object[?(@.type == 'Note')].content//p/div[1]"
Author Public Key
npub1k40kuu4nkyu9q3tm0rdm0u6zvv7kmwf2rhyy9js6lg4h70ak35qqyasznu