Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle nested JSON objects in x-success callback #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swinton
Copy link

@swinton swinton commented Jan 24, 2022

Potential fix for #8.

When an x-callback-url scheme returns nested JSON objects, this should correctly deserialize and serialize as JSON.

E.g. to test with Bear's /todo action:

./xcall -url "bear://x-callback-url/todo?search=Manage%20todos%20with%20Bear%20and%20Alfred&token=$BEAR_TOKEN"

This returns the following JSON object:

{
  "notes": [
    {
      "creationDate": "2022-01-13T20:51:40Z",
      "tags": "[\"2022\",\"todo\",\"2022\\/01\",\"2022\\/01\\/13\"]",
      "title": "#todo Manage todos with Bear and Alfred",
      "modificationDate": "2022-01-19T04:00:06Z",
      "identifier": "65E26BBC-FB7E-46BF-BA5A-CF00E53B9784-42634-00025251E8230FF8",
      "pin": "no"
    }
  ]
}
(Note the tags property isn't correctly handled, I confirmed with the Bear support folks this is due to a limitation with the JSON serializer they are using 😸).

Closes #8.

@kimaldis
Copy link

How can I build a version of xcall with this fix, by hand? or is there better way.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to handle nested JSON objects
2 participants