score:7

i think you can try to json.stringify the object and then json.parse it back

example

pages/index.js

import link from 'next/link';

export default () => {
  const object = {
    key1: 'value1',
    key2: 'value2'
  };

  return (
    <link href={{ pathname: '/about', query: { object: json.stringify(object) } }}>
      <a>here</a>
    </link>
  );
};

pages/about.js

import { withrouter } from 'next/router';

function about({ router: { query } }) {
  const object = json.parse(query.object);

  return (
    <div>
      about {object.key1} | {object.key2}
    </div>
  );
}

export default withrouter(about);

hope this helps!


Related Query

More Query from same tag