I found a solution. To anyone wondering in the future, the problem was that the line
url = url.withPOSTData (JSON::toString (juce::var (dyn_obj)));
Would generate the data in json form like so:
{
"instrument": "piano"
}
However, what was needed in this case apparently is simply
url = url.withPOSTData ("instrument=piano");