How can i get/print variable name from this? I am using arduino Stream to print to console.
#ifndef any_h
#define any_h
#if ARDUINO >= 100
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif
struct any {
  any(Stream& s):serial(s){}
  template <class T>
  void print(const T& msg)
  {
    getName(class T);
    serial.print(msg);
  }
  template <class A, class... B>
  void print(A head, B... tail)
  {
    print('{');
    print(head);
    print(tail...);
  }
  private:
    Stream& serial; 
};
#endif
Usage:
any A(Serial);
int myInt =34;
float myFloat = 944.5555f;
String myString = " this string";
A.print(myInt,myFloat,myString);
current output
34944.555 this string
I am trying to get something like with the same usage/access or like in this: Demo.
{"variableName":value,"variableName":value}
// That is in this case:
{myInt:34,myFloat:944.55,myString: this string}
What i have already tried:
#define getName(x) serial.print(#x)
void print(const T& msg)
{  
   getName(msg);
   //getName(class T);
   serial.print(msg);
}
output : msg34msg944.555msg this string
 
     
    