Add it as a Shared Pipeline Library under Manage Jenkins -> Configure System
Name: socialengine Default Version: master Retrieval Method: Modern SCM
After setting it up, you will have following variable available:
Parses json to be available to you as a LazyMap.
library 'socialengine'
pipeline {
agent none
//...stage,steps,etc
script {
def version = parseJson(readFile('package.json')).version
}
}