Sign file with curl command

As in subject I would like to sign data file, but from what I have read I need to pass it in json form. How can I achieve that?