Since the listing is an array and not an object you need to loop over it with index:

function checkOccurence(data, listing) {
  let dataFound = false;
  for(let i = 0; i < listing.length; i++) {
    if (listing[i].pid === data.pid) {
      dataFound = true;
      break;
    }
  }

  return dataFound;
};

Then you can use the returned boolean in your render to determine success or failure like this:

<div if="checkOccurence(data, listing)"> Success </div> <div v-else>Failure</div>

Answer from Michel Engelen on Stack Overflow
🌐
GitHub
github.com › 5SSS › vue-json-compare
GitHub - 5SSS/vue-json-compare: vue(2.x) json compare components,live demo:https://codesandbox.io/s/suspicious-elion-bwl6v?file=/src/App.vue
import vueJsonCompare from 'vue-json-compare'; const oldData = { name: 'super', age: 18, task: [ { name: 'eat', time: '09:00' }, { name: 'work', time: '10:00', deleted: 'this prop has been deleted!' }, { name: 'sleep', time: '22:00' }, ], }; const newData = { name: 'coolapt', age: 20, task: [ { name: 'eat', time: '09:00' }, { name: 'work', time: '10:00' }, { name: 'sleep', time: '23:00' }, { name: 'running', time: '08:00' }, ], }; export default { components: { vueJsonCompare, }, data() { return { oldData: oldData, newData: newData, }; }, };
Starred by 45 users
Forked by 11 users
Languages   Vue 58.7% | JavaScript 41.3% | Vue 58.7% | JavaScript 41.3%
🌐
npm
npmjs.com › package › vue-json-compare
vue-json-compare - npm
A vue(2.x) components for compare JSON data. Latest version: 3.0.0, last published: 5 years ago. Start using vue-json-compare in your project by running `npm i vue-json-compare`. There are 3 other projects in the npm registry using vue-json-compare.
      » npm install vue-json-compare
    
Published   Aug 20, 2020
Version   3.0.0
Author   alpaca
🌐
CodeSandbox
codesandbox.io › examples › package › vue-json-compare
vue-json-compare examples - CodeSandbox
Use this online vue-json-compare playground to view and fork vue-json-compare example apps and templates on CodeSandbox.
🌐
npm
npmjs.com › package › json-diff-kit
json-diff-kit - npm
import { Differ } from 'json-diff-kit'; // or if you are using vue, you can import the differ only import Differ from 'json-diff-kit/dist/differ'; // the two JS objects const before = { a: 1, b: 2, d: [1, 5, 4], e: ['1', 2, { f: 3, g: null, h: [5], i: [] }, 9], m: [], q: 'JSON diff can\'t be possible', r: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', s: 1024, }; const after = { b: 2, c: 3, d: [1, 3, 4, 6], e: ['1', 2, 3, { f: 4, g: false, i: [7, 8] }, 10], j: { k: 11, l: 12 }, m: [ { n: 1, o: 2 }, { p: 3 }, ], q:
      » npm install json-diff-kit
    
Published   Mar 03, 2026
Version   1.0.35
Author   Rex Zeng
🌐
Vue.js Examples
vuejsexamples.com › a-vue-components-for-compare-json-data
A vue components for compare JSON data
January 3, 2019 - <template> <div> <vue-json-compare :oldData="oldData" :newData="newData"></vue-json-compare> </div> </template> import vueJsonCompare from 'vue-json-compare' export default { components: { vueJsonCompare }, data () { return { oldData: { a: 1, e: 0 }, newData: { a: 2 b: 3 } } } } Json ·
🌐
GitHub
github.com › qinxm › vue-json-diff
GitHub - qinxm/vue-json-diff: A vue json diff component that based on feHelper.
<template> <div id="app"> <json-diff :jsonSourceLeft="leftData" :jsonSourceRight="rightData" /> </div> </template> <script> import JsonDiff from 'vue-json-diff' export default { components: { JsonDiff }, data() { return { leftData: { "data": { "needQueryPosition": 0, "orderStatus": "已取消", "orderTrace": { "timeLine": [ { "date": "10/13", "time": "18:26", "status": "订单已取消" }, { "date": "10/13", "time": "18:11", "status": "订单提交成功" } ], "lastStatusDesc": "订单未支付,已自动取消" } }, "code": 0, "msg": "", "success": true }, rightData: { "data": { "needQueryPo
Starred by 27 users
Forked by 10 users
Languages   CSS 40.9% | Vue 29.6% | JavaScript 29.5% | CSS 40.9% | Vue 29.6% | JavaScript 29.5%
Top answer
1 of 2
2

First off create a method that will return appropriate icon. I believe the code of getIconClass method is self-explanatory. Then loop through leafs field in template and display name of the leaf and appropriate icon.

new Vue({
  el: "#app",
  data() {
    return {
      generalQuestInfo: [{
        "id": 1,
        "name": "Breaking News",
        "alias": "BN",
        "globalId": 1,
        "platform": "Win64",
        "pathway": {
          "status": "Robot",
          "name": "start case",
          "leafs": ["start", "teleport", "take photo", "kill", "finish"]
        }
      }],
      finishedQuestleafs: [
        { name: "start", questId: 2 },
        { name: "teleport", questId: 1 },
        { name: "take photo", questId: 1 },
        { name: "kill", questId: 1 },
        { name: "finish", questId: 1 },
        { name: "start", questId: 2 }
      ]
    }
  },
  methods: {
    getIconClass(id, leaf) {
      return this.finishedQuestleafs.find(item => item.questId === id && item.name === leaf) ? "fa fa-check" : "fa fa-bomb";
    }
  }
})
.as-console-wrapper { max-height: 100% !important; top: 0; }
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <table align="center">
    <tr>
      <th>Status</th>
      <th>Path name</th>
      <th>Leafs Info</th>
    </tr>
    <tr v-for="data in generalQuestInfo" :key="data.id">
      <td>{{data.pathway.status}}</td>
      <td>{{data.pathway.name}}</td>
      <td>
      <ul>
        <li v-for="(leaf, index) in data.pathway.leafs" :key="index">
          <i :class="getIconClass(data.id, leaf)"></i> {{ leaf }}
        </li>
      </ul>
    </td>
    </tr>
  </table>
</div>

2 of 2
1

You could try making a method to check while you're in the v-for loop.

<tr v-for="data in generalQuestInfo">
    <span v-if="hasQuestFinished(data.id, data.pathway.leafs)">
         <!-- display stuff if hasQuestFinished() returned true -->
    </span>
</tr>

And in your vue object (assuming you only want to check if its in the array:

methods:{
   hasQuestFinished(questID, givenQuests){
       finishedQuestleafs.forEach(function(leaf){
          if(leaf.questId == questID && givenQuests.indexOF(leaf.name) >= 0){
              return true;
          }
       });

       //finished the loop without returning means no match
       return false;
   }
}
Find elsewhere
🌐
npm
npmjs.com › package › @types › vue-json-compare
@types/vue-json-compare - npm
import Vue from "vue"; type JsonObject = Record<string, any> | Array<Record<string, any>>; declare class VueJsonCompare extends Vue { oldData: JsonObject; newData: JsonObject; } export default VueJsonCompare;
      » npm install @types/vue-json-compare
    
🌐
DEV Community
dev.to › blamsa0mine › jsoncsv-diff-viewer-1ppa
JSON/CSV Diff Viewer - DEV Community
October 3, 2025 - A single-page web application for comparing two datasets (JSON or CSV) with advanced differentiation capabilities. Built with Vue 3, TypeScript, and Vite, this application runs entirely client-side without requiring a backend.
🌐
CodeSandbox
codesandbox.io › examples › package › vue-json-diff
vue-json-diff examples - CodeSandbox
Vuetify Pagination with Data Fetching (forked) justgowthams1629 · AboutA json diff vue component88Weekly Downloads · Latest version1.0.1 · LicenseISC · External Links · github.com/qinxm/vue-json-diff#readme · github.com/qinxm/vue-json-diff/issues ·
🌐
Bundlephobia
bundlephobia.com › package › vue-json-compare
vue-json-compare ❘ Bundlephobia
Find the size of javascript package vue-json-compare. Bundlephobia helps you find the performance impact of npm packages.
🌐
npm Trends
npmtrends.com › vue-json-compare
vue-json-compare | npm trends
Comparing trends for vue-json-compare 3.0.0 which has 3,905 weekly downloads and unknown number of GitHub stars.
🌐
Vue Script
vuescript.com › home › other › diff viewer plugin for vue.js 3
Diff Viewer Plugin For Vue.js 3 - Vue Script
June 9, 2022 - A Vue.js diff viewer plugin that can be used to compare the difference between the two code snippets. css · xml: xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist, svg · markdown: markdown, md, mkdown, mkd · javascript: javascript, js, jsx · json · plaintext: plaintext, txt, text ·
🌐
npm
npmjs.com › package › vue-json-diff
vue-json-diff - npm
<template> <div id="app"> <json-diff :jsonSourceLeft="leftData" :jsonSourceRight="rightData" /> </div> </template> <script> import JsonDiff from 'vue-json-diff' export default { components: { JsonDiff }, data() { return { leftData: { "data": { "needQueryPosition": 0, "orderStatus": "已取消", "orderTrace": { "timeLine": [ { "date": "10/13", "time": "18:26", "status": "订单已取消" }, { "date": "10/13", "time": "18:11", "status": "订单提交成功" } ], "lastStatusDesc": "订单未支付,已自动取消" } }, "code": 0, "msg": "", "success": true }, rightData: { "data": { "needQueryPo
      » npm install vue-json-diff
    
Published   Oct 22, 2020
Version   1.0.1
Author   qinxm
🌐
Skypack
skypack.dev › view › vue-json-compare
npm:vue-json-compare | Skypack
import vueJsonCompare from 'vue-json-compare' export default { components: { vueJsonCompare }, data () { return { oldData: { a: 1, e: 0 }, newData: { a: 2 b: 3 } } } }
🌐
npm
npmjs.com › package › vue-diff
vue-diff - npm
json · plaintext: plaintext, txt, text · typescript: typescript, ts · npm install highlight.js · import VueDiff from 'vue-diff'; import 'vue-diff/dist/index.css'; // extend yaml language import yaml from 'highlight.js/lib/languages/yaml'; VueDiff.hljs.registerLanguage('yaml', yaml); app.use(VueDiff); Check supported languages of Highlight.js · Comparing text from many lines can slow down performance.
      » npm install vue-diff
    
Published   Jun 08, 2022
Version   1.2.4
Author   hoiheart
🌐
Codespots
codespots.com › library › item › 1017
A vue components for compare JSON data-Codespots.com
<template> <div> <vue-json-compare :oldData="oldData" :newData="newData"></vue-json-compare> </div> </template> import vueJsonCompare from 'vue-json-compare' export default { components: { vueJsonCompare }, data () { return { oldData: { a: 1, e: 0 }, newData: { a: 2 b: 3 } } } } not yet...
🌐
Npm
npm.io › package › vue-json-compare
Vue-json-compare NPM | npm.io
import vueJsonCompare from 'vue-json-compare' export default { components: { vueJsonCompare }, data () { return { oldData: { a: 1, e: 0 }, newData: { a: 2 b: 3 } } } }