thehyve / react-json-to-table

react-json-to-table
GNU General Public License v3.0
36 stars 28 forks source link

Objects are not valid as a React child error for complex JSON input #10

Closed rajdude0 closed 4 years ago

rajdude0 commented 4 years ago

I get this error Objects are not valid as a React child (found: object with keys {username, bio, image, following}). If you meant to render a collection of children, use an array instead.

https://codesandbox.io/s/test-react-json-to-table-wf51h

when applying this or similar complex JSON

  "articles": [
    {
      "title": "sdf ",
      "slug": "sdf-6rn1a0",
      "body": "sdfd ",
      "createdAt": "2019-11-20T08:04:41.791Z",
      "updatedAt": "2019-11-20T08:04:41.791Z",
      "tagList": [],
      "description": "sf ",
      "author": {
        "username": "smallcat",
        "bio": null,
        "image": "https://static.productionready.io/images/smiley-cyrus.jpg",
        "following": true
      },
      "favorited": false,
      "favoritesCount": 1
    },
    {
      "title": "zzz",
      "slug": "zzz-i5r3ff",
      "body": "nihao 世界",
      "createdAt": "2019-11-20T07:11:13.723Z",
      "updatedAt": "2019-11-20T07:11:13.723Z",
      "tagList": [],
      "description": "chi",
      "author": {
        "username": "smallcat",
        "bio": null,
        "image": "https://static.productionready.io/images/smiley-cyrus.jpg",
        "following": true
      },
      "favorited": false,
      "favoritesCount": 1
    },
    {
      "title": "dawangpaiwolaixunshan",
      "slug": "dawangpaiwolaixunshan-5sqlyi",
      "body": "ssssssssssssssssssssssssssssssssssssssssssss",
      "createdAt": "2019-11-19T08:36:16.310Z",
      "updatedAt": "2019-11-19T08:36:16.310Z",
      "tagList": [],
      "description": "111111",
      "author": {
        "username": "smallcat",
        "bio": null,
        "image": "https://static.productionready.io/images/smiley-cyrus.jpg",
        "following": true
      },
      "favorited": false,
      "favoritesCount": 0
    },
    {
      "title": "你好,Melissa ",
      "slug": "melissa-lmc1pe",
      "body": "安抚",
      "createdAt": "2019-11-19T08:35:23.323Z",
      "updatedAt": "2019-11-19T08:35:23.323Z",
      "tagList": [],
      "description": "阿萨",
      "author": {
        "username": "smallcat",
        "bio": null,
        "image": "https://static.productionready.io/images/smiley-cyrus.jpg",
        "following": true
      },
      "favorited": true,
      "favoritesCount": 1
    }
  ],
  "articlesCount": 4
}

Raised a PR with the fix: https://github.com/thehyve/react-json-to-table/pull/11

jonassvalin commented 4 years ago

It seems like the fix for this has been merged, but no release has been made. Can someone please do the release?

pvannierop commented 4 years ago

@jonassvalin The problem is that the frontend developer that maintained this repo has left our company. I have access but I have no clue how to make an npm release. Could you provide assistance here?

jonassvalin commented 4 years ago

I see @pvannierop , thanks for the clarification. Assuming you have access also to the npm repository ( https://www.npmjs.com/package/react-json-to-table ), you should be able to follow the steps outlined here under The “Standard” Release Process https://cloudfour.com/thinks/how-to-publish-an-updated-version-of-an-npm-package/

Effectively npm run build to prepare the release, npm version to bump the version, and npm publish to publish the new release.

pvannierop commented 4 years ago

@jonassvalin I have published the new version. Please notify me when there are problems. Thnx!