Skip to content

MsgPack 6.0.1-beta #772

@trap98

Description

@trap98

Hey, i'm updating my project for use your new feature 'MsgPack', after 1 day i'm okay with the new API and i try to use this feature. I can serialize without any problem but when I try to deserialize, and serialize in json format this time, my json is empty. I think i don't understand the API or idk, someone can help me ? thanks.
Esp8266 - master expressif

String CoolFileSystem::getSavedLogAsString(int num) {
  char path[32];
  String data;
  DynamicJsonDocument document;
  snprintf(path, 32, "/log/%d.json", num);
  File f = SPIFFS.open(path, "r");

  if (!f) {
    ERROR_VAR("Failed to data file:", path);
    return data;
  }
  deserializeMsgPack(document, f);
  serializeJson(document, data);
  DEBUG_VAR("Read data file:", path);
  DEBUG_VAR("Data file content:", data);
  f.close();
  yield();
  return data;
}

my file :

��state��reported��timestamp�2018-06-29T14:17:11Z�mac�2C3AE84FC076�firmwareVersion�v0.2.6-2-g0ea852c�visibleLight�infraRed�ultraViolet�Temperature�Pressure�Humidity�Vbat�soilMoisture�ActB

my serial output :

DEBUG: Data file content: {}
DEBUG: Saved JSON data to send: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv6ArduinoJson 6

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions