Skip to content

Weird symbols for JsonObject #366

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

Closed
fabiosoft opened this issue Oct 8, 2016 · 2 comments
Closed

Weird symbols for JsonObject #366

fabiosoft opened this issue Oct 8, 2016 · 2 comments
Labels
question v5 ArduinoJson 5

Comments

@fabiosoft
Copy link

I encode the json like this:

  DynamicJsonBuffer jsonBuffer;
  JsonObject& ack = jsonBuffer.createObject();
  ack[F("id")] = Discovery::getChipId_hex();
  ack[F("ssid")] = WiFi.SSID();
  ack[F("localip")] = WiFi.localIP().toString();
  ack[F("mac")] = WiFi.macAddress();

  int len = ack.measureLength();
  char buffer[len];
  ack.printTo(DEBUG_SERIAL);
  ack.printTo(buffer, ack.measureLength());

But instead to get printed this:

{"id": "xxxxx","ssid": "fabio_link_fast","localip": "192.168.1.106","mac": "XX:XX:XX:XX:XX:XX"}

I get

{"\bd":"\4\c3\34\4","ss\bd":"\c\fb\bo_l\bnk_\c\fst","lo\4\fl\bp":"1\32.168.1.106","m\f\4":"XX:XX:\3:XX"

What is this?? How to solve?

@bblanchon
Copy link
Owner

bblanchon commented Oct 9, 2016

Even if that's not the cause of your problem, I highly recommend not to use flash strings with ArduinoJson (at least not now, see #76).

I tried your code and it works.
Did you show all the relevant code?

See:

@bblanchon
Copy link
Owner

@fabiosoft, any progress?

Repository owner locked and limited conversation to collaborators Sep 21, 2018
@bblanchon bblanchon added the v5 ArduinoJson 5 label Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question v5 ArduinoJson 5
Projects
None yet
Development

No branches or pull requests

2 participants