#include "ipld.h" int main() { //TURN DEBUG MODE ON/OFF NODE_H_DEBUG = 0; //Load a node from string: char * str = "{\"@context\": \"/ipfs/Qmf1ec6n9f8kW8JTLjqaZceJVpDpZD4L3aPoJFvssBE7Eb/merkleweb\", \"@type\": \"node\", \"FIELD1\": { \"@value\": \"Qmf1ec6n9f8kW8JTLjqaZceJVpDpZD4L3aPoJFvssBE7Eb\", \"@type\": \"mlink\" }, \"FIELD2\": { \"@value\": \"Qmf1ec6n9f8kW8JTLjqaZceJVpDpZD4L3aPoJFvssBE7Eb\", \"@type\": \"mlink\" } }"; struct NODE A; A = LOAD_NODE(str); //Get node contents back to a string: char * lol; lol = json_dumps(A.obj, JSON_INDENT(1) | JSON_PRESERVE_ORDER); printf("NODE CONTENTS: \n------------\n%s\n------------\n", lol); free(lol); // Never forget to free the char * after being done with it. //Get type of node, if any. char typeget[1000]; //Way bigger than needed. bzero(typeget,1000); //No mem errors ofc. nType(typeget, A.obj);//Check for type if any printf("type: %s\n", typeget); //Get context of node. char ctxget[1000]; //Way bigger than needed bzero(ctxget, 1000); nContext(ctxget, A.obj); printf("ctx: %s\n", ctxget); //Extracting Links char * links[666]; for(int i=0;i<666;i++){ links[i] = NULL;} size_t linknum; linknum = nLinks(links, A.obj); //These all need to be freed, hence the linknum! printf("Linknum: %lu\n", linknum); for(int i=0; i